Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / couple questions

Author
Message
Guitar_M
20
Years of Service
User Offline
Joined: 2nd Oct 2003
Location:
Posted: 2nd Oct 2003 21:55
i am used to 3d crap, but i decided to work on 2d. one question is how do i get the ms paint dude to move? and i do i make a shooting game (like what is the code for shooting?

Derek miller
Licaon
20
Years of Service
User Offline
Joined: 30th Sep 2003
Location: Far in the south
Posted: 3rd Oct 2003 00:00
Not a Genius on the subject but...

Load the image, and asign it to sprite
in the main loop, scan for keyboard, if keys are arrows, modify the x and y coords of the sprite. That'all about it for a movement routine.

Fire routine: when scancode is spacebar (ie) get the origin coordinates for the bullet, that's the dude's coordinates
increment the axis you fire the bullet across until it hits a boundary or an object.
the bullet routine should be in the main loop and be called only if the bullet has been shot(that could be done with a flag than puts to true when you press the fire button, and be set to false when the bullet is moving)

hope it helps

9 of every 10 people are exactly the 90 %
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 3rd Oct 2003 04:03
I don't know how experienced you are, but I'd like to make things really simple based on the structure of your question.

A bullet could either be a sprite (little travelling object) or an image (a stationary type graphic, that you cleverly move yourself) or even a plane (A 3D object made to look flat, and 2D.) As any of these travel accross the screen you are updating their X coordinate. If they travel upwards or downwards you are updating their Y coordinate. Diagonal and you update both at the same time. As the X/Y coordinate is changing it can be compared with the X/Y coordinate of an enemy object. This can be done by yourself, or it can be done by DBPro/DB. When the X/Y coordinate is simalar to the enemy then you change the enemy graphic into an explosion graphic, this is done by simply changing a number. This has been a very simple example of game code.

Pincho.
Evil Noodle
21
Years of Service
User Offline
Joined: 28th Apr 2003
Location:
Posted: 5th Oct 2003 12:59
Hey Pincho I just cut+pasted that code into dbpro and it dosnt work. I this a dbc game???
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 5th Oct 2003 14:13
Lol! Coz I spelled Similar wrong!

Pincho.

Login to post a reply

Server time is: 2024-05-05 14:39:15
Your offset time is: 2024-05-05 14:39:15