I've been working on tutorial six in the Shadow Monsters series. It is going well and I hope to finish it tomorrow. This tutorial covers talking with NPCs.
Let's talk a bit of theory. What exactly should happen in the update part of the game loop. Here is where you update the game world, handle any input, check for collision between game objects and the environment and any other processing that needs to be done. For 2D games collision between objectts is usually done with bounding boxes. It can also be done a variety of other ways such as per pixel, pixel perfect, proximity and others.
Bounding box is done by creating rectangles around game objects and checking if the two intersect. If they do there is a collision between them and needs to be handled properly. Sometimes you want a finer degree of control when your game objects have a lot of transparency or are not rectangular in shape. Enter per pixel or pixel perfect collision detection which work at the pixel level. Sometimes you need to know if two objects are close. Enter proximity collision detection. There are other ways of handling collision detection but those are the most common. An example is multiple bounding boxes where an object may be cross shaped and you test the two rectangles and see if either collide.
That's it for today. Stay tuned for more tutorials and some talk about theory.
No comments:
Post a Comment