Be a Supporter!

Making my first flash game!

  • 288 Views
  • 11 Replies
New Topic Respond to this Topic
SuperBastard
SuperBastard
  • Member since: Oct. 13, 2010
  • Offline.
Forum Stats
Supporter
Level 14
Artist
Making my first flash game! 2011-09-19 23:33:05 Reply

I'm hunkering down right now to get to work on my first flash game. I plan to make a Pong game, and I want it to be as awesome as I can possibly make it.

I have a few questions for now though, and I'm sure more will pop up, so if any veteran actionscripters can help me out or give me input, I'd be extremely grateful for any help I can get!

Alright, so my first problem is this: I went ahead and made up a song to loop in the background already, and Flash compressed it so much it's pretty badly distorted. That's not the end of it though; for some reason I can no longer import the .mp3 into Flash, or convert the .mov online the way I did before.

SuperBastard
SuperBastard
  • Member since: Oct. 13, 2010
  • Offline.
Forum Stats
Supporter
Level 14
Artist
Response to Making my first flash game! 2011-09-20 01:17:31 Reply

Also, would it be a terrible idea to make some of the graphics in Photoshop? I was thinking about using something like this as a background, for example. Obviously I'd be worried about bad scaling, is there any way to limit the scale of the .swf file or something?

Making my first flash game!

PSvils
PSvils
  • Member since: Feb. 3, 2010
  • Offline.
Forum Stats
Member
Level 01
Game Developer
Response to Making my first flash game! 2011-09-20 01:24:28 Reply

I'm not sure about your audio problems, sounds like a Flash glitch or something...And for the distortion, you can go into Publishing Settings, check out the audio tab, and it should show you compression options and stuff.

For the background, for sure, what's the difference in using Photoshop? If you mean bitmaps in general, a lot of games use them. You can expect your .swf being one size on the web, and so just turn scaling off, and then don't worry about it!

SuperBastard
SuperBastard
  • Member since: Oct. 13, 2010
  • Offline.
Forum Stats
Supporter
Level 14
Artist
Response to Making my first flash game! 2011-09-20 01:48:31 Reply

Oh sweet, that's good to know. Thanks, man!

Bit of an update on that background art, it's starting to look a little bit dark. I'm wondering if it would be worthwhile to give the paddles and ball a bit of glow, or if that would cause a little too much burden on the player's computer.

Also uploaded that crummy audio track I was fiddling with...

  • 8-bit Frolic
    8-bit Frolic by SuperBastard

    Click to listen.

    Score
    0 / 5.00
    Type
    Loop
    Genre
    Video Game
    Popularity
    1 Views

It doesn't really seem fitting for a pong game, but we'll see how it works out!

Making my first flash game!

SuperBastard
SuperBastard
  • Member since: Oct. 13, 2010
  • Offline.
Forum Stats
Supporter
Level 14
Artist
Response to Making my first flash game! 2011-09-20 03:08:56 Reply

Interestingly, I'm seeing some significant degradation of image quality when importing .PNG files from Photoshop into Flash.

I've tried this before and received significantly better results:
http://www.newgrounds.com/dump/item/46f9 9df03a5633540712855a3fb25f84

I don't know why things are deciding to look crappy this time. Should I try using .JPGs?

SuperBastard
SuperBastard
  • Member since: Oct. 13, 2010
  • Offline.
Forum Stats
Supporter
Level 14
Artist
Response to Making my first flash game! 2011-09-20 05:41:53 Reply

Totally been up all night doing this... My brain is giving out on me and I seem to have bungled something in this code. There are no compiler errors so I'm going to assume it's a mathematical issue.

:onClipEvent(load){
this._x=275;
this._y=200;
this.fullspeed=14;
this.xspeed=9;
this.yspeed=random(10);
this.udist=0;
this.edist=0;
this.ufraction=0;
this.efraction=0;
}
onClipEvent(enterFrame){
if(this._y=0 && this.yspeed<0){
this._yspeed=+this.yspeed;
}
if(this._y=400 && this.yspeed>0){
this._yspeed=-this.yspeed;
}
if(this.hitTest(_root.lpaddle)){
this.udist=_root.lpaddle._y-_root.ball._
y;
if(this.udist!=0){
this.ufraction=this.udist/(_root.lpaddle ._height/2)
this.yspeed=-((1-Math.abs(this.ufraction ))*this.fullspeed);
this.xspeed=this.ufraction*this.fullspee d;
} else {
if(this.usdist==0){
this.xspeed=-this.fullspeed;
}
if(this.xspeed>0){
this.xspeed=+this.xspeed;
}
}
if(this.hitTest(_root.rpaddle)){
this.edist=_root.rpaddle._y-this._y;
if(this.edist!=0){
this.efraction=this.edist/(_root.rpaddle ._height/2)
this.yspeed=-(1-Math.abs(this.efraction)
*this.fullspeed);
this.xspeed=this.efraction*this.fullspee d;
} else {
this.xspeed=this.fullspeed;
}
if(this.xspeed<0){
this.xspeed=-this.xspeed;
}
}
this._x=+this.xspeed;
this._y=+this.yspeed;
if(this._x>550 || this._x<0){
this.reset();
}
}
}

The player's paddle is on the left, at the low end of x. The AI is on the right. When I preview the flash, the ball simply appears at the top center of the screen and stays there.

My eyes are bleeding and my brain is numb.

jonathansario
jonathansario
  • Member since: Sep. 15, 2009
  • Offline.
Forum Stats
Member
Level 01
Blank Slate
Response to Making my first flash game! 2011-09-20 08:14:04 Reply

Hi. What kind of authoring tool are you using?

I use Flash CS4 and for that software, I can control the compression of each image or sound file I use in my flash whenever its compiled.

I simply right click the image/sound in the library and open its properties. There are options there that let me change the compression. The higher the compression, the poorer the quality but the swf file becomes smaller. You can also set it so no compression takes place.

Try to check the Publish Settings under File menu. You can change general sound and image compression there too.

And as far as I know, Photoshop and Flash are like partners. In fact, CS4 allows to directly import individual layers from PSD files into its library.

SuperBastard
SuperBastard
  • Member since: Oct. 13, 2010
  • Offline.
Forum Stats
Supporter
Level 14
Artist
Response to Making my first flash game! 2011-09-20 10:26:30 Reply

I see, thank you very much. I suppose I should have specified earlier that I'm running CS5, actionscript 2.0.

I found what you were talking about, I think it made a difference, but I can't see so well right now because I haven't slept.

SuperBastard
SuperBastard
  • Member since: Oct. 13, 2010
  • Offline.
Forum Stats
Supporter
Level 14
Artist
Response to Making my first flash game! 2011-09-20 17:22:47 Reply

Still having issues with that code, I just can't seem to figure out why it's not working...

SuperBastard
SuperBastard
  • Member since: Oct. 13, 2010
  • Offline.
Forum Stats
Supporter
Level 14
Artist
Response to Making my first flash game! 2011-09-21 13:26:28 Reply

Still stuck at this:

onClipEvent (load) {
this._x = 275;
this._y = 200;
this.fullspeed = 14;
this.xspeed = -9;
this.yspeed = Math.random(10);
this.udist = 0;
this.edist = 0;
this.ufraction = 0;
this.efraction = 0;
leftscore = 0;
rightscore = 0;
}
onClipEvent (enterFrame) {
this._x += this.xspeed;
this._y += this.yspeed;
if (this._y = 0 && this.yspeed < 0)
{
this.yspeed += this._y;
}
if (this._y = 400 && this.yspeed > 0)
{
this.yspeed -= this._y;
}
if (this.hitTest(_root.lpaddle))
{
this.udist = _root.lpaddle._y - _root.ball._y;
if (this.udist != 0)
{
this.ufraction = this.udist / (_root.lpaddle._height / 2);
this.yspeed = -((1 - Math.abs(this.ufraction)) * this.fullspeed);
this.xspeed = this.ufraction * this.fullspeed;
}
else
{
if (this.udist == 0)
{
this.xspeed = -this.fullspeed;
}
if (this.xspeed > 0)
{
this.xspeed = +this.xspeed;
}
}
if (this.hitTest(_root.rpaddle))
{
this.edist = _root.rpaddle._y - this._y;
if (this.edist != 0)
{
this.efraction = this.edist / (_root.rpaddle._height / 2);
this.yspeed = -(1 - Math.abs(this.efraction) * this.fullspeed);
this.xspeed = this.efraction * this.fullspeed;
}
else
{
this.xspeed = this.fullspeed;
}
if (this.xspeed < 0)
{
this.xspeed = -this.xspeed;
}
}

if (this._x > 550 || this._x < 0)
{
if (this._x > 550)
{
leftscore++;
_root.leftbox.text = leftscore;
}
if (this._x < 0)
{
rightscore++;
_root.rightbox.text = rightscore;
}
}
}
}

The ball will move, but still originates at the top of the screen.

Wolfos
Wolfos
  • Member since: Jan. 19, 2008
  • Offline.
Forum Stats
Member
Level 25
Game Developer
Response to Making my first flash game! 2011-09-21 15:18:07 Reply

http://wolfos.org/using-code-tags-on-new grounds/

SuperBastard
SuperBastard
  • Member since: Oct. 13, 2010
  • Offline.
Forum Stats
Supporter
Level 14
Artist
Response to Making my first flash game! 2011-09-21 23:19:35 Reply

At 9/21/11 03:18 PM, Wolfos wrote: http://wolfos.org/using-code-tags-on-new grounds/

Haha, thanks man, sorry about that...