Advertisement

Displaying game object concept ---> help me.

Started by October 14, 2000 05:45 AM
1 comment, last by wedgeboy 24 years, 3 months ago
hi, Recently i m planing on making a 2d side scroller aircarft shooting game, i alredy think about the game concept flow but when come to the game logic part , i get confuse. i try to put in a scenario. Hope that anyone that got the idea can explain them to me SCENARIO: Inside the game my player craft will fly in the space and then starting some enemy will appears....if one enemy appears...the screen will show one enemy and the game logic do all the collision detection and AI stuff base on the enemy. Problem: MY first problem is...how to make a few enemy appears at the same time and each of them got the capability to detect their own collision and performing AI stuff. My second problem is...how is the system gonna display several enemy images at the same time and make it random on the display location? how can this happen when the first enemy image appear and the sys keep doing first enemy animation and then a second enemy image appear. I m quite blur already .. sorry if you dont understand what i trying to explain. I really hoping that someone can help me solve this concept thing.. Pls free to email me : beserker@tm.net.my / beserker@maxis.net.my
That kind of question is hard to understand but I try.

The most simple form of collisiondetection is to use bounding boxes you should find tutorials about them by just searching it from programming section.

You should have class(Or struct) for you ship it should include speed,x,y(postitions) and other variables.

When game starts player is alone on the map. When variable get´s triggered(Example time elapsed,player reached some position) then you create enemy(He may appear to random location or mission-specific location).

Displaying ship is easy.Ship is tringle.Just use trigonometry and psychic formulas to calculate moving capabilities. Then draw the triangle to screen.

Game has somesort of main-loop. It calculates positions, collisions,ship angle.Then draw the screen. Loop lasts until player "Aborts the mission".

I suggest you to buy Lamothe`s book
Advertisement
Hi,

normally your main game component is a (main) loop. In every loop cycle you read the keyboard/mouse/joystick input and apply this data to the player controlled entity, you let every other object in your game calculate its new state (new position, switch from patrol to attack mode, etc. everything is time dependent (time delta from the last update of the objects)) (these updates are dependet on the events form the last loop cycle) , then you have to check for collisions and decide what a collision means (a bullet hits a monster -> will it die?, the player collides with a wall -> push him back so that he doesn''t intersect the wall, etc...), now you apply these passive updates to your game objects (but now they shouldn''t act on it - in the next loop cycle they will get the chance to act on the events (to think about them) in this loop cycle there''s only passive reaction). Afterwards you create the complete next image to show on the monitor. Then you display the complete new image and starts the next cycle.

Everything unclear now? Ask further!

Bjoern

This topic is closed to new replies.

Advertisement