[gameprogrammer] Re: Flash Games
- From: Stephen Smith <gp@xxxxxxxxxxxxxxxxxxxxxxxx>
- To: gameprogrammer@xxxxxxxxxxxxx
- Date: Tue, 17 Oct 2006 19:25:40 +0100
Here's a slight tweak to that: instead of creating a new var for each
key, what I do is create a boolean array, and then on a KeyDown event (I
use Java so whatever the C equivalent is) just set the cell of the ascii
code to true (and false when the key is released).
Steve
Alan Wolfe wrote:
Oh here's another concept which greatly helps in game programming...
Instead of checking for keyboard events (such as making the player
move when the player presses an arrow key), what you want to do is
store the STATES of keys - whether they are pressed down or not.
for example, when the user presses the right arrow key, instead of
moving the player, just set RightArrowKeyPressed=1, and when they let
go of the key, set RightArrowKeyPressed=0.
Then, in your UpdateWorld function, all you do is...
if(RightArrowKeyPressed==1)
//move player right
if(LeftArrowKeyPressed==1)
//move player left
if(SpaceBarPressed==1)
//shoot a bullet
when you do it this way, it makes for much smoother controls, and lets
you do things like move diagonally and shoot at the same time - as
well as holding in the fire button to do rapid fire.
On 10/16/06, *David Cornell* <kaosboy192000@xxxxxxxxx
<mailto:kaosboy192000@xxxxxxxxx>> wrote:
I want to create a Flash MX game in the side-scrolling beat-em-up
fashion, hopefully 3/4 perspective, but I have NO IDEA how to
start aside from sketching character models, scanning them in, and
editing variations with a good art editor. Beyond that, I could
use a technical starting point for this project.
---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html
- Follow-Ups:
- [gameprogrammer] Re: Flash Games
- From: Christoph Harder
- [gameprogrammer] Re: Flash Games
- From: Scott Harper
- References:
- [gameprogrammer] Flash Games
- From: David Cornell
- [gameprogrammer] Re: Flash Games
- From: Alan Wolfe
Other related posts:
- » [gameprogrammer] Flash Games
- » [gameprogrammer] Re: Flash Games
- » [gameprogrammer] Re: Flash Games
- » [gameprogrammer] Re: Flash Games
- » [gameprogrammer] Re: Flash Games
- » [gameprogrammer] Re: Flash Games
- » [gameprogrammer] Re: Flash Games
- » [gameprogrammer] Re: Flash Games
- » [gameprogrammer] Re: Flash Games
Instead of checking for keyboard events (such as making the player move when the player presses an arrow key), what you want to do is store the STATES of keys - whether they are pressed down or not.
for example, when the user presses the right arrow key, instead of moving the player, just set RightArrowKeyPressed=1, and when they let go of the key, set RightArrowKeyPressed=0.
Then, in your UpdateWorld function, all you do is...
if(RightArrowKeyPressed==1)
//move player right
if(LeftArrowKeyPressed==1)
//move player left
if(SpaceBarPressed==1)
//shoot a bullet
when you do it this way, it makes for much smoother controls, and lets you do things like move diagonally and shoot at the same time - as well as holding in the fire button to do rapid fire.
On 10/16/06, *David Cornell* <kaosboy192000@xxxxxxxxx <mailto:kaosboy192000@xxxxxxxxx>> wrote:
I want to create a Flash MX game in the side-scrolling beat-em-up
fashion, hopefully 3/4 perspective, but I have NO IDEA how to
start aside from sketching character models, scanning them in, and
editing variations with a good art editor. Beyond that, I could
use a technical starting point for this project.--------------------- To unsubscribe go to http://gameprogrammer.com/mailinglist.html
- [gameprogrammer] Re: Flash Games
- From: Christoph Harder
- [gameprogrammer] Re: Flash Games
- From: Scott Harper
- [gameprogrammer] Flash Games
- From: David Cornell
- [gameprogrammer] Re: Flash Games
- From: Alan Wolfe