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.

Newcomers DBPro Corner / I need help making a first game

Author
Message
Linux
18
Years of Service
User Offline
Joined: 7th Apr 2006
Location:
Posted: 7th Apr 2006 11:21
Having owned Dark Basic for 3 years now and have only made programs with Text and such in them for personal use I want to make simple 2D type games like Pong, Space Invaders, Breakout, etc. To start out simple I would like to learn how to make Pong but the Tutorials I've found in the Codebase are a bit confusing for me.

I'm not asking for somebody to make a game for me but I am asking if somebody would please help me out step by step and help me understand until I get the hang of it and complete my first Pong clone.
Gil Galvanti
19
Years of Service
User Offline
Joined: 22nd Dec 2004
Location: Texas, United States
Posted: 8th Apr 2006 18:26
Big Man
19
Years of Service
User Offline
Joined: 4th Feb 2005
Location: BEHIND YOU!!!! (but I live in England)
Posted: 8th Apr 2006 18:32
Can I ask what dark basic language you are using (Classic or pro)?

I made a pong game in DB classic but never took the time to convert it to pro.

Cheers

BM

Our aim is to keep the loo's clean, your aim can help.
Linux
18
Years of Service
User Offline
Joined: 7th Apr 2006
Location:
Posted: 10th Apr 2006 09:56
I'm using DarkBasic Classic and I'm using the "DarkEdit" editor because I find it much more convienant to use. I've looked around at some Tutotirals and kind of have a grasp on some basics but when I put an image {Pong Bat for exampe} on the screen and position it, I can't figure out how to make it move.

Could you help me :3? What's the best way of adding my images that I created?

Here are some images I made for the Pong Game in Paint earlier.

tiffer
18
Years of Service
User Offline
Joined: 6th Apr 2006
Location: Scotland
Posted: 11th Apr 2006 00:09
(if anyone makes fun of this then get a life)

well first things first you should be using sprites instead of images, their easier to handle and they allow transparency and collision.

Secondly images dont move as such, they reposition (like a teleport) i'll break it down a bit better.

What you need to do is have a position for the object stored into 2 variables. so its x(across) axis could be stored in a variable called batx# and the y(up and down) could be stored in baty#, notice the hash which indicates a real number.

In games we use whats called a main program loop, which is what we refer to as the engine because it drives the game.
So the engine which is a repeating piece of code will start with a do command and end with a symnc followed by a loop usually.
Now what you do is you start with 2 two coordinates that will place the bat somewhere centrally at bottom. so x=300 and y=370. now every time the program loops you want the sprite to be repeatedly placed using the variable coordinates x and y.

The next part is the movement part. basically every time the the left key is pressed you want to decrement x by about 2 depending on the speed you want the bat to move. Then when the right key is pressed you want to increase by the same ammount, thus repositioning your object.

Hope this is a help it might help you understand the tutorial by the. To load a sprite in darkbasic i think the command is load sprite "filename", (sprite number ie 1)
Then you can place it and replace ot anywhere on screen using sprite x,y,image numbe) eg sprite batx#,baty#, 1

eg:

remember that's just an example, you will obviously need to change the file name and you may want to modify this slighty, to change the speeds and add variables to stop the bat from dissappearing ie
if leftkey()=1
if x>0
x=x-2
endif
endif

it seems complicated but after a while you'll be treaching this to your pets as a new trick so dont be discouraged

C.Watson

Login to post a reply

Server time is: 2024-11-27 22:45:05
Your offset time is: 2024-11-27 22:45:05