Be a Supporter!

Help with Platform Game!!

  • 1,041 Views
  • 35 Replies
New Topic Respond to this Topic
Bjorvy
Bjorvy
  • Member since: Aug. 4, 2009
  • Offline.
Forum Stats
Member
Level 06
Artist
Help with Platform Game!! 2010-03-21 13:40:28 Reply

Hey guys.

So I'm making a Flash Mario game, and I do not know how to make a moving sprite.
For example, if you press the Left key, Mario walks to the left as an animation.
I only know how to make a Grey square and it doesn't do anything...

Please help me!


-Insert Lame Ass Text Here Until Clever Enough To Make An Image-

ProfessorFlash
ProfessorFlash
  • Member since: Oct. 6, 2007
  • Offline.
Forum Stats
Member
Level 32
Programmer
Response to Help with Platform Game!! 2010-03-21 13:44:24 Reply

You know how to make a grey square that doesn't do anything? Wow! You got a lot of potential m8!


You can solve pretty much any problem you may have with AS3 by consulting the AS3 Language reference.

Bjorvy
Bjorvy
  • Member since: Aug. 4, 2009
  • Offline.
Forum Stats
Member
Level 06
Artist
Response to Help with Platform Game!! 2010-03-21 13:47:22 Reply

At 3/21/10 01:44 PM, ProfessorFlash wrote: You know how to make a grey square that doesn't do anything? Wow! You got a lot of potential m8!

That's not how i meant. I mean it can move in all directions and jump and stuff, but it's still just a grey square that's stuck in one frame!


-Insert Lame Ass Text Here Until Clever Enough To Make An Image-

4urentertainment
4urentertainment
  • Member since: Aug. 1, 2008
  • Offline.
Forum Stats
Moderator
Level 13
Game Developer
Response to Help with Platform Game!! 2010-03-21 13:57:35 Reply

At 3/21/10 01:47 PM, Bjorvy wrote: That's not how i meant. I mean it can move in all directions and jump and stuff, but it's still just a grey square that's stuck in one frame!

Well, in the part where you tell the grey box to move, tell it to also go to the walking frame. Problem solved.

Bjorvy
Bjorvy
  • Member since: Aug. 4, 2009
  • Offline.
Forum Stats
Member
Level 06
Artist
Response to Help with Platform Game!! 2010-03-21 14:00:11 Reply

At 3/21/10 01:57 PM, 4urentertainment wrote:
At 3/21/10 01:47 PM, Bjorvy wrote: That's not how i meant. I mean it can move in all directions and jump and stuff, but it's still just a grey square that's stuck in one frame!
Well, in the part where you tell the grey box to move, tell it to also go to the walking frame. Problem solved.

First, it's supposed to be a Mario sprite. And second, stop goofing around! The square was just an example! Please can someone serious help me?


-Insert Lame Ass Text Here Until Clever Enough To Make An Image-

Neo-13
Neo-13
  • Member since: Jun. 9, 2007
  • Offline.
Forum Stats
Member
Level 23
Programmer
Response to Help with Platform Game!! 2010-03-21 14:09:37 Reply

At 3/21/10 02:00 PM, Bjorvy wrote:
At 3/21/10 01:57 PM, 4urentertainment wrote: Well, in the part where you tell the grey box to move, tell it to also go to the walking frame. Problem solved.
First, it's supposed to be a Mario sprite. And second, stop goofing around! The square was just an example! Please can someone serious help me?

That was serious...


BBS Signature
Bjorvy
Bjorvy
  • Member since: Aug. 4, 2009
  • Offline.
Forum Stats
Member
Level 06
Artist
Response to Help with Platform Game!! 2010-03-21 14:10:26 Reply

At 3/21/10 02:09 PM, Neo-13 wrote:
At 3/21/10 02:00 PM, Bjorvy wrote:
At 3/21/10 01:57 PM, 4urentertainment wrote: Well, in the part where you tell the grey box to move, tell it to also go to the walking frame. Problem solved.
First, it's supposed to be a Mario sprite. And second, stop goofing around! The square was just an example! Please can someone serious help me?
That was serious...

But what does he mean with "in the part where you tell the grey box to move, tell it to also go to the walking frame"?


-Insert Lame Ass Text Here Until Clever Enough To Make An Image-

4urentertainment
4urentertainment
  • Member since: Aug. 1, 2008
  • Offline.
Forum Stats
Moderator
Level 13
Game Developer
Response to Help with Platform Game!! 2010-03-21 14:12:19 Reply

At 3/21/10 02:10 PM, Bjorvy wrote: But what does he mean with "in the part where you tell the grey box to move, tell it to also go to the walking frame"?

In your code...that you apparently copied from a tutorial without learning what it does...

Bjorvy
Bjorvy
  • Member since: Aug. 4, 2009
  • Offline.
Forum Stats
Member
Level 06
Artist
Response to Help with Platform Game!! 2010-03-21 14:17:41 Reply

At 3/21/10 02:12 PM, 4urentertainment wrote:
At 3/21/10 02:10 PM, Bjorvy wrote: But what does he mean with "in the part where you tell the grey box to move, tell it to also go to the walking frame"?
In your code...that you apparently copied from a tutorial without learning what it does...

Hehe, yeah. That was what I thought you meant. But since I do not know this, can anybody of you guys help me out?


-Insert Lame Ass Text Here Until Clever Enough To Make An Image-

Drakenflight
Drakenflight
  • Member since: Feb. 23, 2010
  • Offline.
Forum Stats
Member
Level 03
Blank Slate
Response to Help with Platform Game!! 2010-03-21 14:27:35 Reply

You can 'nest' MovieClips inside eachother. Your main MovieClip (the square atm) has two frames. On the first frame, you would place a MovieClip of mario standing. In the second frame you would place a MovieClip of him running, which is an animation and would contain multiple frames.

In your code, make the MovieClip go to and stop on frame 2 while you're pressing one of the directional buttons, and frame 1 when you're not.

Bjorvy
Bjorvy
  • Member since: Aug. 4, 2009
  • Offline.
Forum Stats
Member
Level 06
Artist
Response to Help with Platform Game!! 2010-03-21 14:28:48 Reply

At 3/21/10 02:27 PM, Drakenflight wrote: You can 'nest' MovieClips inside eachother. Your main MovieClip (the square atm) has two frames. On the first frame, you would place a MovieClip of mario standing. In the second frame you would place a MovieClip of him running, which is an animation and would contain multiple frames.

Great! Thanks a ton! That really helped! Now i can start working. :D


-Insert Lame Ass Text Here Until Clever Enough To Make An Image-

ProfessorFlash
ProfessorFlash
  • Member since: Oct. 6, 2007
  • Offline.
Forum Stats
Member
Level 32
Programmer
Response to Help with Platform Game!! 2010-03-21 14:38:11 Reply

I'm gonna do a game called "A Grey square that doesn't do anything". It will be a physics game. So thanks for this idea :D.


You can solve pretty much any problem you may have with AS3 by consulting the AS3 Language reference.

Bjorvy
Bjorvy
  • Member since: Aug. 4, 2009
  • Offline.
Forum Stats
Member
Level 06
Artist
Response to Help with Platform Game!! 2010-03-21 14:41:50 Reply

If anybody knows, what do I type to make it go to the other frame? And how do I turn the sprite around, if i want Mario to go to the Left instead of Right for example.


-Insert Lame Ass Text Here Until Clever Enough To Make An Image-

Drakenflight
Drakenflight
  • Member since: Feb. 23, 2010
  • Offline.
Forum Stats
Member
Level 03
Blank Slate
Response to Help with Platform Game!! 2010-03-21 14:47:50 Reply

At 3/21/10 02:38 PM, ProfessorFlash wrote: I'm gonna do a game called "A Grey square that doesn't do anything". It will be a physics game. So thanks for this idea :D.

Make sure you credit Bjork with the intelectual property.

Bjorvy
Bjorvy
  • Member since: Aug. 4, 2009
  • Offline.
Forum Stats
Member
Level 06
Artist
Response to Help with Platform Game!! 2010-03-21 14:50:02 Reply

At 3/21/10 02:38 PM, ProfessorFlash wrote: I'm gonna do a game called "A Grey square that doesn't do anything". It will be a physics game. So thanks for this idea :D.

Then you hafta credit me for inspiration! ;)


-Insert Lame Ass Text Here Until Clever Enough To Make An Image-

Drakenflight
Drakenflight
  • Member since: Feb. 23, 2010
  • Offline.
Forum Stats
Member
Level 03
Blank Slate
Response to Help with Platform Game!! 2010-03-21 14:50:38 Reply

At 3/21/10 02:41 PM, Bjorvy wrote: If anybody knows, what do I type to make it go to the other frame? And how do I turn the sprite around, if i want Mario to go to the Left instead of Right for example.
mario.gotoAndStop(n);

where n is the frame you want it to go to.

To turn him around just multiply mario.scaleX by -1;

Bjorvy
Bjorvy
  • Member since: Aug. 4, 2009
  • Offline.
Forum Stats
Member
Level 06
Artist
Response to Help with Platform Game!! 2010-03-21 14:56:06 Reply

Do I name the Movieclip Mario instead of character?


-Insert Lame Ass Text Here Until Clever Enough To Make An Image-

zrb
zrb
  • Member since: Aug. 8, 2006
  • Offline.
Forum Stats
Member
Level 11
Blank Slate
Response to Help with Platform Game!! 2010-03-21 15:27:45 Reply

At 3/21/10 02:56 PM, Bjorvy wrote: Do I name the Movieclip Mario instead of character?

You don't need to you replace mario by character using his code.


School Sux ! || As :Main || As3: Main || Animation: Main || Flash Tutorials ||

BBS Signature
Drakenflight
Drakenflight
  • Member since: Feb. 23, 2010
  • Offline.
Forum Stats
Member
Level 03
Blank Slate
Response to Help with Platform Game!! 2010-03-21 16:05:32 Reply

At 3/21/10 02:56 PM, Bjorvy wrote: Do I name the Movieclip Mario instead of character?

well yeah, I'm can't actually read your mind. I was just using 'mario' as an example of your object. name it whatever you want, but use whatever name you pick everytime you rever to that particular object.

CrustySheet
CrustySheet
  • Member since: May. 3, 2006
  • Offline.
Forum Stats
Member
Level 04
Blank Slate
Response to Help with Platform Game!! 2010-03-21 18:30:03 Reply

Are you REALLY going to ask for every single line of code? or are you going to go and learn?!

Unknown999
Unknown999
  • Member since: Jul. 12, 2004
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Response to Help with Platform Game!! 2010-03-21 19:56:24 Reply

At 3/21/10 01:44 PM, ProfessorFlash wrote: You know how to make a grey square that doesn't do anything? Wow! You got a lot of potential m8!

He totally stole that idea from me!

Here's the proof!

evibini
evibini
  • Member since: Aug. 15, 2008
  • Offline.
Forum Stats
Member
Level 05
Blank Slate
Response to Help with Platform Game!! 2010-03-21 20:06:26 Reply

This is for your character movieclip. These are for the left and right movements. ground is the instance name your ground should have.

if (Key.isDown(Key.RIGHT)) {
_x += speed;
_xscale = scale;
if (_root.ground.hitTest(_x, _y+3, true)) {
this.gotoAndStop(1);
} else {
this.gotoAndStop(2);
}
} else if (Key.isDown(Key.LEFT)) {
_x -= speed;
_xscale = -scale;
if (_root.ground.hitTest(_x, _y+3, true)) {
this.gotoAndStop(1);
} else {
this.gotoAndStop(2);
}

On frame 2 of the movieclip (character you're playing), make the character a movieclip and make it a walking sprite.


BBS Signature
CrustySheet
CrustySheet
  • Member since: May. 3, 2006
  • Offline.
Forum Stats
Member
Level 04
Blank Slate
Response to Help with Platform Game!! 2010-03-21 20:16:26 Reply

At 3/21/10 08:06 PM, evibini wrote: This is for your character movieclip.

I'm Curious can you explain this line to me

if (_root.ground.hitTest(_x, _y+3, true)) {

evibini
evibini
  • Member since: Aug. 15, 2008
  • Offline.
Forum Stats
Member
Level 05
Blank Slate
Response to Help with Platform Game!! 2010-03-21 20:26:59 Reply

At 3/21/10 08:16 PM, CrustySheet wrote:
At 3/21/10 08:06 PM, evibini wrote: This is for your character movieclip.
I'm Curious can you explain this line to me

if (_root.ground.hitTest(_x, _y+3, true)) {

That means if the character (Mario) is in fact touching the instance, ground, then a certain action will occur.


BBS Signature
CrustySheet
CrustySheet
  • Member since: May. 3, 2006
  • Offline.
Forum Stats
Member
Level 04
Blank Slate
Response to Help with Platform Game!! 2010-03-21 20:45:57 Reply

At 3/21/10 08:26 PM, evibini wrote:
At 3/21/10 08:16 PM, CrustySheet wrote:
At 3/21/10 08:06 PM, evibini wrote: This is for your character movieclip.
I'm Curious can you explain this line to me

if (_root.ground.hitTest(_x, _y+3, true)) {
That means if the character (Mario) is in fact touching the instance, ground, then a certain action will occur.

i c..

was wondering if you knew that you're using a shapeflag :P and not just a copy paste code.

Hoeloe
Hoeloe
  • Member since: Apr. 29, 2004
  • Offline.
Forum Stats
Member
Level 37
Game Developer
Response to Help with Platform Game!! 2010-03-22 03:15:09 Reply

At 3/21/10 08:45 PM, CrustySheet wrote: was wondering if you knew that you're using a shapeflag :P and not just a copy paste code.

The shapeflag allows you to put any shape of ground underneath the character, rather than splitting it into lots of rectangular blocks. You can put all the ground in the level together into one clip if you use shapeflag.


Song of the Firefly is on Steam Greenlight and Kickstarter. Give them a look and support the project!
------------------------------

BBS Signature
CrustySheet
CrustySheet
  • Member since: May. 3, 2006
  • Offline.
Forum Stats
Member
Level 04
Blank Slate
Response to Help with Platform Game!! 2010-03-22 03:34:35 Reply

At 3/22/10 03:15 AM, Hoeloe wrote: The shapeflag allows you to put any shape of ground underneath the character, rather than splitting it into lots of rectangular blocks. You can put all the ground in the level together into one clip if you use shapeflag.

This i know!! was wondering if he knew what he was pasting or just copy pasting from tutorials like so many here do then come ask for help cos they don't understand it

At 3/21/10 07:56 PM, Unknown999 wrote:
At 3/21/10 01:44 PM, ProfessorFlash wrote: You know how to make a grey square that doesn't do anything? Wow! You got a lot of potential m8!
He totally stole that idea from me!

Here's the proof!

Too Easy!!!

Here's the proof

Help with Platform Game!!

Unknown999
Unknown999
  • Member since: Jul. 12, 2004
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Response to Help with Platform Game!! 2010-03-22 04:19:05 Reply

At 3/22/10 03:34 AM, CrustySheet wrote: Too Easy!!!

Here's the proof

It's not easy!

You just haven't beaten level 26 and unlocked Super-Hardcore+++ mode where you, if you ever get that far, end up in fight to the death with the evil twin brother "Slightly Darker Shaded Grey Square That doesn't do Anything either%u2122".

Bjorvy
Bjorvy
  • Member since: Aug. 4, 2009
  • Offline.
Forum Stats
Member
Level 06
Artist
Response to Help with Platform Game!! 2010-03-28 13:38:31 Reply

At 3/21/10 08:06 PM, evibini wrote: This is for your character movieclip. These are for the left and right movements. ground is the instance name your ground should have.

if (Key.isDown(Key.RIGHT)) {
_x += speed;
_xscale = scale;
if (_root.ground.hitTest(_x, _y+3, true)) {
this.gotoAndStop(1);
} else {
this.gotoAndStop(2);
}
} else if (Key.isDown(Key.LEFT)) {
_x -= speed;
_xscale = -scale;
if (_root.ground.hitTest(_x, _y+3, true)) {
this.gotoAndStop(1);
} else {
this.gotoAndStop(2);
}

I've inserted this in the movieclips actionscript, but I only get a bunch of errors... Is it something I've forgotten?
**Error** Scene=Scene 1, layer=Character, frame=1:Line 9: Statement block must be terminated by '}'
} else if (Key.isDown(Key.LEFT)) {

**Error** Scene=Scene 1, layer=Character, frame=1:Line 16: Syntax error.
}

**Error** Scene=Scene 1, layer=Character, frame=1:Line 1: Statement must appear within on/onClipEvent handler
if (Key.isDown(Key.RIGHT)) {

Total ActionScript Errors: 3 Reported Errors: 3

That's what it says.


-Insert Lame Ass Text Here Until Clever Enough To Make An Image-

<deleted>
Response to Help with Platform Game!! 2010-03-28 13:50:29 Reply

At 3/21/10 02:38 PM, ProfessorFlash wrote: I'm gonna do a game called "A Grey square that doesn't do anything". It will be a physics game. So thanks for this idea :D.

Free blam point! YAY!