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.
you can use hitTest for questions 2 and 3. question 1 is pretty basic enterFrame code.
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.
Thanks! I think i got it.
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?
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.
Don't see what you're looking for? Try a search.
|