Hi Ryan, yes and no. If you're using collision detection, you can actually have your player's avatar move and if he's unable to do that then the collision detection routines can stop him for you. YOu don't even need a flag.
If your player is moving at a slower speed and touches a wall, then gently stop him. If he is running and touches a wall then give him some damage, stop him and bounce him back a bit based on his velocity. Does this make sense? It's really the job of the collision detection to decide whether or not your player can move. Obviously there may be other situations you may want to check for other than collisions but the concept of attempting the move is what I'm getting at here. In a real physical situation sometimes you can't walk because the hill is too steep. Know what I mean? Nothing is really stopping you but there's a physical reason. YOu attempt to walk but find you cannot. So let's look at this another way; You're velocity is 0. You attempt to walk which simply changes your velocity to something greater than 0. The game loop processes your player's movement and if nothing is preventing you from moving in the direction you want at the speed you want then you do. Simple as that. If something is in your way then your collision detection will stop you or move you back to where you were and reassign your velocity to 0. Obviously this is really primitive but do you get the idea? Also, as Ian has mentioned, you would want to also take into account the timing of your game loop or your frame rate as we've been calling it as well, to manage your movements. YOu can sort of think of this as a movie. But it's a dynamic movie with interaction. :) Does this make sense? If not then by all means, just shout back out! -And I'm happy to clarify and I'm sure Thomas, Ian and others will happily do so as well. :) HTH Cara :) --- View my Online Portfolio at: http://www.onemodelplace.com/CaraQuinn Follow me on Twitter! https://twitter.com/ModelCara On Jul 30, 2013, at 3:12 PM, Ryan Strunk <[email protected]> wrote: Hi Cara, I haven't pondered this. Are you saying, for example, that you could give the player a forward velocity of 0.1, and as long as walking is true, update that every time through the game loop? Then if the velocity is 0, he just wouldn't move? Fascinating concept. I wouldn't mind some clarification. All the best, Ryan -----Original Message----- From: Gamers [mailto:[email protected]] On Behalf Of Cara Quinn Sent: Tuesday, July 30, 2013 3:27 PM To: Gamers Discussion list Subject: Re: [Audyssey] looking for programming advice: cyntaxdifferencebetween bgt and java Hey there y'all, Maybe I'm missing something here, but rather than using a timer at all, would it not be more appropriate to simply calculate a velocity vector each frame which could either stay static or change depending on the player's surroundings. This way the player's movement could be calculated and performed every frame. No timer necessary. thanks for the great thread! Smiles, Cara :) --- Gamers mailing list __ [email protected] If you want to leave the list, send E-mail to [email protected]. You can make changes or update your subscription via the web, at http://audyssey.org/mailman/listinfo/gamers_audyssey.org. All messages are archived and can be searched and read at http://www.mail-archive.com/[email protected]. If you have any questions or concerns regarding the management of the list, please send E-mail to [email protected]. --- Gamers mailing list __ [email protected] If you want to leave the list, send E-mail to [email protected]. You can make changes or update your subscription via the web, at http://audyssey.org/mailman/listinfo/gamers_audyssey.org. All messages are archived and can be searched and read at http://www.mail-archive.com/[email protected]. If you have any questions or concerns regarding the management of the list, please send E-mail to [email protected].
