Hi John, essentially yes, with a couple of caveats…

As long as you call your collision detection every frame, you don't necessarily 
need to call it from within your movement methods. As long as it gets called to 
check your objects' positions then you're fine. Does this make sense?

Also, when collisions are detected, you don't necessarily need to stop your 
game loop. It depends on what you'd like to have happen when you see a 
collision. I.E. maybe you'd just like your player to bounce back from whatever 
it collided with… In this case, you still want your game loop to be running so 
that your player's new movement will happen.

If you want some special scene to happen or your game to stop immediately upon 
a collision, then yes, you'd want your game loop to stop when your collision 
happens. Does this make sense?…

HTH and talk soon!…

Smiles,

Cara :)
---
View my Online Portfolio at:

http://www.onemodelplace.com/CaraQuinn

Follow me on Twitter!

https://twitter.com/ModelCara

On Aug 17, 2013, at 6:21 AM, john <[email protected]> wrote:

I know it's been a while since this thread has been active, but I'm going 
through my old emails, and was wondering if I could get some more clarification 
on this subject. The way I'm understanding this, you would build two functions: 
one for collision detection and one for movement. The movement would run every 
time through the game loop, and would call the collision detection from within 
itself. The movement function would change the player's position, call the 
collision detection function, and if that returns safe, update the game world. 
Does this sound somewhat correct?

Thanks,
John.

----- Original Message -----
From: Cara Quinn <[email protected]
To: Gamers Discussion list <[email protected]
Date sent: Tue, 30 Jul 2013 17:38:43 -0700
Subject: Re: [Audyssey] looking for programming advice:cyntaxdifferencebetween 
bgt and java

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

---
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].

Reply via email to