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! / dont know 2d

Author
Message
redeye
20
Years of Service
User Offline
Joined: 30th Oct 2003
Location:
Posted: 2nd Nov 2003 13:53
im new to dark basic i can do things in 3d but dont have a clue in 2d so could any one help me make a simple 2d game like pong or snake or something plz

im new to games creation so plz help if you can
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 2nd Nov 2003 15:47 Edited at: 2nd Nov 2003 15:50
If you know 3D then it's best to stick with it even for 2D games like pong. Just use plains with textures on them to get the flat pictures that you need for the game. Then face the camera towards them. The collision for 2D games has nearly always been array collision. This is where you make a collision engine from a map containing zero's and 1's. Zero's are ignored, and 1's are a collision. This works in 3D just as well as 2D.

Pseudo Code......

Dim Map(800,600) for perfect pixel collision on 800*600 screen.
Dim Map(800/32,600/32) for Pacman type collision.

Fill the map with Data

Loop Y
Loop X
Read Map(X,Y)
End Loop X
End Loop Y

Data 1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1


How do you make the collision Data.

Make a mask in black for collision areas by drawing over your screen pics. Make a proggy to check the screen for black areas that stores a 1 in the Dim(X,Y) positions.


If it's pong then you make an array for the bat. Or use sprite collision. The walls could just be....

Pseudo code...
If BallSpriteX > 790 Then rebound
If BallSpriteX < 10 Then rebound
If BallSpriteY > 590 Then rebound
If BallSpriteY < 10 Then rebound

If you really want to try 2D then most things are drawn to Bitmaps. Images are often Pasted to the screen, and sprites are used a lot. Arrays are often used for collision, and two screens are often swapped between, one temporary/Invisible screen like a Clipboard. The other visible screen being screen 0, and being the main game arena.

Pincho.
Codger
21
Years of Service
User Offline
Joined: 23rd Nov 2002
Location:
Posted: 3rd Nov 2003 02:54
Here Pong

Just Add Scoring & Sound



System
PIII 650 MZ H.P. Pavillion
394 Mem GeForce 4 400MX
CloseToPerfect
21
Years of Service
User Offline
Joined: 20th Dec 2002
Location: United States
Posted: 3rd Nov 2003 06:51
codger, that is really nice coding, vary simple amd easy to fallow. I wish my code would be that neat, seems I start off neat and end up with spagetti code everytime.

CTP
redeye
20
Years of Service
User Offline
Joined: 30th Oct 2003
Location:
Posted: 3rd Nov 2003 13:03
thanx for the code im going to try it now

im new to games creation so plz help if you can

Login to post a reply

Server time is: 2024-04-28 16:37:25
Your offset time is: 2024-04-28 16:37:25