Hi Cara,
Interesting. I guess this is up to personal style, but as I understand
it you would separate the movement functions from the collision
detection function like this.
while (running)
{
// Update player movement and position
UpdatePosition();
// Update collision detection
UpdateCollision();
// Sleep for x MS
Sleep(time);
}
Is this an accurate assessment of how you would write your main loop
and separate collision detection and movement?
Cheers!
On 8/18/13, Cara Quinn <[email protected]> wrote:
> Hi again John,
>
> Just as a follow-up to my own note here, I thought I'd add that I personally
> prefer not to have collision detection called from within any movement
> code.
>
> I think it's good practice to have your methods only doing what they say
> they will. I.E. movement only moves. Collision detection only detects
> collisions.
>
> this way if you want to move your player for some other reason than a
> traditional game movement, you can always call your player's movement
> methods and not need to worry about some other method getting called
> somewhere to get in the way of what you'd like to do. Does this make sense?
>
> Your collision detection method can either report back which objects
> collided, or simply call the appropriate methods on those objects that
> collided with each other.
>
> For example, if two objects collide, then call the touch methods on each of
> those objects. That way each object will do what it is supposed to when it
> is touched by another object.
>
> Hope this helps!
>
> Have a great day!
>
> 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].