all groups > flash actionscript > august 2004 >
You're in the

flash actionscript

group:

3 questions about game programming



3 questions about game programming Luagorn
8/8/2004 6:14:02 PM
flash actionscript: I am going to program an arcade game and there are 3 things i want to know.
1. How can i make my guy shoot a laser beam (bullet).
2. How can i make the laser beam hit an opponent.
3. How can i make my guy stop walking when he hits a wall or other debris.
Re: 3 questions about game programming _jrh_
8/8/2004 7:57:28 PM
you can use hitTest for questions 2 and 3. question 1 is pretty basic enterFrame code.

Re: 3 questions about game programming abeall
8/8/2004 11:52:34 PM
You have a long journey. :-) I've built platformers, arcade games, and a RTS
engine, and this is what every onbe coems down to:
A) Knowing alot of ins and outs about AS. Sorry, but things pop up and you
have to know what to do, which takes time.
B) Beyond that, the core engine is usually this
1) duplicateMovieClip()
2) hitTest
3) onEnterFrame
4) Math(object) for 360 degree style games
5) Lot's of variables!

So learn those things, and you've got a good start.
Re: 3 questions about game programming Luagorn
8/9/2004 6:26:57 AM
Thanks! I think i got it.
Re: 3 questions about game programming Luagorn
8/9/2004 6:40:48 AM
PS.
I have tried to make hitTest but it does only work on 1 thing, when my guy
hits the right wall he stop but when he moves into a barrel he goes through. My
code is:

on (keyPress "<Right>") {
if (_root.man.hitTest(right_wall(barrel))) {
_root.man._x -= 5;
}
_root.man.gotoAndStop("right");
_root.man._x += 5;
}

Whats wrong?
Re: 3 questions about game programming abeall
8/9/2004 3:21:54 PM
How I have built my games is like this:
1 MC containst the level. Walls, barrels, pick-ups, andything the play must
interact with. Then I use a point-to-object hittest, because an
object-to-object hittest cannot use shapeflag. I actually use multiple
point-to-object hittest, to form a sort of perimeter around the player. NOTE:
you only need to detect the hittest in the direction the player is moving. IE
if your player is moving right, you only need to detect hittests on the right
of your player, not the left.
Re: 3 questions about game programming abeall
8/9/2004 6:40:54 PM
here, i just made this. very basic, pretty sloppy, not very fun, but you can
take a look at the source to see some of the very basics of Flash movement,
hittest, and duplicate movie clip

http://media.heraldic.us/games/combat.swf
http://media.heraldic.us/games/combat.fla

HTH
AddThis Social Bookmark Button