Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > General > Gaming and Game Development

Reply
 
Thread Tools Rate Thread Display Modes
Old 03-07-2010, 02:02 AM   #1
blue969
Registered User
 
Join Date: Mar 2010
Location: I'm not telling!
Posts: 14
Question [AS3] walls and sprites

I haven't coded much in actionscript yet, but anyway, I was wondering about coding walls and sprites.

Walls-how would you make it so that if a character hits a wall, it can't go through it. Would you multiply the walls width and heigth by each other and tell it that it couldn't go inside the boundaries of it or what?

Sprites-If you want it so that a character will have a different appearance when walking left and a different one when walking right or shooting or jumping, how would you do this?
blue969 is offline   Reply With Quote
Old 03-07-2010, 02:38 AM   #2
Impacatus
Senior Member
 
Join Date: Jan 2009
Posts: 163
Default

Quote:
Originally Posted by blue969 View Post
I haven't coded much in actionscript yet, but anyway, I was wondering about coding walls and sprites.

Walls-how would you make it so that if a character hits a wall, it can't go through it. Would you multiply the walls width and heigth by each other and tell it that it couldn't go inside the boundaries of it or what?
Look up hitTestObject and hitTestPoint. These will tell you if two objects are touching, and you can adjust their speed and/or position accordingly.

Quote:
Sprites-If you want it so that a character will have a different appearance when walking left and a different one when walking right or shooting or jumping, how would you do this?
There are alot of ways to do it, but one common with is to make each frame in the timeline a different sprite. For example, frame one could be standing and frame two could be jumping. If the character jumps, call gotoAndStop(2), when they land, call gotoAndStop(1).
Impacatus is offline   Reply With Quote
Old 03-07-2010, 04:53 PM   #3
blue969
Registered User
 
Join Date: Mar 2010
Location: I'm not telling!
Posts: 14
Default

QOUTE-There are alot of ways to do it, but one common with is to make each frame in the timeline a different sprite. For example, frame one could be standing and frame two could be jumping. If the character jumps, call gotoAndStop(2), when they land, call gotoAndStop(1).

I don't know if what I heard was true, but I heard that that could only be done in as2?

Last edited by blue969; 03-07-2010 at 05:29 PM.
blue969 is offline   Reply With Quote
Old 03-07-2010, 07:23 PM   #4
Impacatus
Senior Member
 
Join Date: Jan 2009
Posts: 163
Default

Quote:
I don't know if what I heard was true, but I heard that that could only be done in as2?
I'm very sure it can be done in AS3. Where did you hear that it couldn't?
Impacatus is offline   Reply With Quote
Old 03-07-2010, 07:29 PM   #5
blue969
Registered User
 
Join Date: Mar 2010
Location: I'm not telling!
Posts: 14
Default

I forgot the exact name of the website, but it was some tutorial website.
blue969 is offline   Reply With Quote
Old 03-07-2010, 07:42 PM   #6
Impacatus
Senior Member
 
Join Date: Jan 2009
Posts: 163
Default

Maybe they meant the commands were different or something. You still have a timeline in AS3, and you can still stop it on certain frames.
Impacatus is offline   Reply With Quote
Old 03-08-2010, 12:15 AM   #7
blue969
Registered User
 
Join Date: Mar 2010
Location: I'm not telling!
Posts: 14
Default

Also, another question I have is how would I make a flash game have multiple levels/stages in it?(I have some Ideas but I think there is probably better and easier ways than the idea I have)
blue969 is offline   Reply With Quote
Old 03-08-2010, 01:46 AM   #8
Impacatus
Senior Member
 
Join Date: Jan 2009
Posts: 163
Default

I would just make each level a different movieclip.

If you want to make a level editor though, you'd need to write some kind of algorithm to generate the level based on data you provide.
Impacatus is offline   Reply With Quote
Old 03-09-2010, 04:47 AM   #9
blue969
Registered User
 
Join Date: Mar 2010
Location: I'm not telling!
Posts: 14
Question

I actually thought of the movieclip Idea before, but then I noticed that if you press ENTER on the flash player you can start or stop the movie, so doesn't that mean you can skip a level if you press enter?
blue969 is offline   Reply With Quote
Old 03-09-2010, 05:38 AM   #10
Impacatus
Senior Member
 
Join Date: Jan 2009
Posts: 163
Default

I assume you mean in the flash testing environment. I don't think you can affects swfs you play in your browser that way.

Also, you're probably thinking of frames, not MovieClips.
Impacatus is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:46 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.