Computer Science Canada [Tutorial] Calculating Square Boundaries |
Author: | tjmoore1993 [ Sat May 09, 2009 12:39 pm ] | ||||||
Post subject: | [Tutorial] Calculating Square Boundaries | ||||||
What is collision? A collision is an isolated event in which two or more bodies (colliding bodies) exert relatively strong forces on each other for a relatively short time. Why do we need it? Games and applications without an occasional hit would be boring. Hit? Well most games now are fighting based and when things are hit they would have to respond right? When a programmer programs a game or application they must (not always the case) have to implement a collision detection to make sure if characters or buttons are touched they do what they are suppose to do. What kind of games or applications? In Turing specifically we have fighting and shooting kind of games which will need some sort of collision. Applications will normally have buttons either implemented by a GUI or through "Pic.Draw" function which would need a command to make sure the actual object its self is being toggled properly. Getting started The easiest way to get started is to grab a picture that isn't so big but roughly around 100x100. This is so that we have enough space to get an output of the important information.
This will help you figure out your boundaries by taking the x1 and y1 and adding it accordingly Example:
In order to test that our values are correct we must setup a statement. There is a problem though we do not want to waste time setting up a crash of some sort so we will use the simple mouse method. Example:
That's it for my tutorial if you have any questions feel free to ask! |