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 can't make the simplist game!

Author
Message
The dude guy
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: In the streets of sasatuin
Posted: 18th Aug 2004 11:29
Sorry. Nope. No more questions.

Andrew Tamalunas
code spinneker
20
Years of Service
User Offline
Joined: 18th Aug 2004
Location: My Computer
Posted: 20th Aug 2004 01:08
You were complaining about 3d gamemaker earlier is it that bad? My brother wants it so I'm wondering if he should still get it. The best tutorial is the one in the help file but that one doesn't work with DBPTrial so youll have to wait until u get the full version!
The dude guy
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: In the streets of sasatuin
Posted: 20th Aug 2004 01:14
Don't get the 3d Gamemaker!!!!! Sure there may be updates but the 3d gamemaker still sucks and is not up-to-date. Don't waste 35 bucks on that crap, please.

Andrew Tamalunas
The dude guy
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: In the streets of sasatuin
Posted: 20th Aug 2004 23:38
All you need to do is:
Print Spacebar is all you need
Wait Key

Whenever I press the space bar it exits!

Andrew Tamalunas
The dude guy
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: In the streets of sasatuin
Posted: 21st Aug 2004 00:41
Nope...

Andrew Tamalunas
The dude guy
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: In the streets of sasatuin
Posted: 21st Aug 2004 00:45
I won't be avalible for... 3-4 hours or less sorry!

Andrew Tamalunas
Ilya
21
Years of Service
User Offline
Joined: 10th Aug 2003
Location:
Posted: 21st Aug 2004 01:08 Edited at: 21st Aug 2004 01:10
Ok here's a game tutorial:
(Most lines are commented)
It's called Big mouth, small mouth.
It will tell you if you have a big mouth by asking you one question
If you answer wrong, your PC will pay(not really)!

`There's no excaping he11
DISABLE ESCAPEKEY
DISABLE SYSTEMKEYS
`Make text appear like when a person talks
print "Did this help you"
`Ask a question like when a person asks a question
input "(Y/N) ",yn$
`Make yn capitilized so the ppl can't write n and mean y
yn$=UPPER$(yn$)
`Find out the answer and if it's N...
if yn$="N" or yn$="I HATE ILYA"
`And if it is...
`KILL THIER PC
`Note: this won't kill thier pc but will force them to plug it out
`You don't need to know...
do
i2=i2+1
if i2=5000
hide window
center text screen width()/2,screen height()/2,"You have a big mouth."
wait 500
do
loop
endif
`Ok now they really crossed da line.
if escapekey()=1
restore window
center text screen width()/2,screen height()/2,"Now you crossed da line!"
wait 500
hide window
do
`Ok enough punishment
if i=1000
hide window
center text screen width()/2,screen height()/2,"You have a very big mouth."
wait 500
do
loop
endif
i=i+1
make object sphere i,10
loop
`Go back to if
endif
`Minimize da window
minimize window
`Make text on a random place on the screen saying "U suk b@lls!!!"
center text rnd(screen width()),rnd(screen height()),"U suk b@lls!!!"
`Restore the window
restore window
`Go back to "Do"
loop
`Go back to If and this wont happen
endif
EXIT PROMPT "You don't have a big mouth.","Congradulations!"

The dude guy
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: In the streets of sasatuin
Posted: 21st Aug 2004 01:23
Too many errors!

Andrew Tamalunas
Ilya
21
Years of Service
User Offline
Joined: 10th Aug 2003
Location:
Posted: 21st Aug 2004 01:24
Oh made another one!

`There's no excaping he11
DISABLE ESCAPEKEY
DISABLE SYSTEMKEYS
`Load a DLL
load dll "winmm.dll",2
`Make text appear like when a person talks
print "Did this help you"
`Ask a question like when a person asks a question
input "(Y/N) ",yn$
`Make yn capitilized so the ppl can't write n and mean y
yn$=UPPER$(yn$)
`Find out the answer and if it's N...
if yn$="N" or yn$="I HATE ILYA"
`And if it is...
`KILL THIER CDR
hide window
do
`Call a dll
CALL DLL 2,"mciSendStringA","set CDAudio door open"," ",1,0
loop
endif
EXIT PROMPT "You don't have a big mouth.","Congradulations!"

Ilya
21
Years of Service
User Offline
Joined: 10th Aug 2003
Location:
Posted: 21st Aug 2004 01:25
Quote: "Too many errors!"

I didn't get one.
What errors?

soapyfish
20
Years of Service
User Offline
Joined: 24th Oct 2003
Location: Yorkshire, England
Posted: 21st Aug 2004 04:09 Edited at: 21st Aug 2004 04:09
Okay, this thread has just got confusing, The dude guy if you still want help making a game I'll quite happily post a super simple pong tutorial, explaining everything, and with all the media you need uploaded to the net for you to download, and even if your on 56k (which I am) a small white rectangle doesn't take much downloading now does it.

Formely code2kill
To tell you the truth, I'm just glad I DON'T enjoy playng The Sims.
the play2kill fan club
The dude guy
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: In the streets of sasatuin
Posted: 21st Aug 2004 05:08
Thanks could you post it soon?

Andrew Tamalunas
soapyfish
20
Years of Service
User Offline
Joined: 24th Oct 2003
Location: Yorkshire, England
Posted: 21st Aug 2004 11:13 Edited at: 21st Aug 2004 11:19
Right, lets get started, just one thing, In your next post could you tell me if your using Dark BASIC Classic or Dark BASIC Professional, Thanks. I don't think It'll make a jot of difference but it's better to be safe than sorry.

First of all we need the media, this is the sounds, pictures, etc that we are going to see and hear in the game.

The Ball
http://code2kill.dbspot.com/website/ball.bmp

The Enemy Bat/Paddle
http://code2kill.dbspot.com/website/enemy_bat.bmp

The Bottom Horizontal Wall
http://code2kill.dbspot.com/website/horizontal_wall_bottom.bmp

The Top Horizontal Wall
http://code2kill.dbspot.com/website/horizontal_wall_top.bmp

The Players Bat/Paddle
http://code2kill.dbspot.com/website/player_bat.bmp

The Vertical Wall
http://code2kill.dbspot.com/website/vertical_wall.bmp

The Beep (sound)
http://code2kill.dbspot.com/website/beep.wav

To download them, right click on the link (the blue writing) and go to save target as.

Once you've downloaded them you'll be ready for the next part of the tut, I would of made this one a little longer but it's 2:10a.m. as I type this. The next tut will concentrate on setting up your project folder, and typing in your first few commands (all fully explaind.) If there's anything you don't understand just say and I'll happily go over it again.

p.s. Sorry if some of the things in the tut seem a little simple, I'm not saying your retarted, I'm just explaining things as simply as possible.

Formely code2kill
To tell you the truth, I'm just glad I DON'T enjoy playng The Sims.
the play2kill fan club
The dude guy
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: In the streets of sasatuin
Posted: 21st Aug 2004 11:29
! It's only 8:23 here!!!!! I use DBP.

Quote: "p.s. Sorry if some of the things in the tut seem a little simple, I'm not saying your retarted, I'm just explaining things as simply as possible."


Yeah I know... Thanks for making it as simple as possible.

Andrew Tamalunas
soapyfish
20
Years of Service
User Offline
Joined: 24th Oct 2003
Location: Yorkshire, England
Posted: 22nd Aug 2004 04:23
Now you've downloaded all your media we need to put it in the right place so the program will be able to find it when it needs it.

Open up DBP and go to File, then New Project. Type in the name of your project (pong, or something else if you want) in the top box, leave the others as they are then click OK.

You should then see a screen saying....

Rem Project:
Rem Created: 21/08/2004 16:44:04 (or whatever time you created your project)

Rem ***** Main Source File *****


Now we have a place for all our media to go, we need to put it there. Exit DBP, clicking yes when asked if you want to save any changes (I don't think you have to click yes, but I always do.)

Now go to whichever folder you put your media in when you downloaded it. You then need to copy all your media, you can do this by holding down Ctrl and click on on all the folders, you want to copy, one at a time. When you've selected all your media, go to edit, and then copy.

Next, go to my computer, then click on the icon that says Local Disk (C look through the list of folders until you find one called Program Files, click on that, then on the one called Dark Basic Software, then The one called Dark Basic Professional. Once you've done that, click on the foldercalled projects. Now you have to find your project folder, if you've called your program pong, it will be the one called pong, or whichever folder has the same name as your project. Once your there (there should already be a few folders in there) go to edit, then paste. Hopefully, all the media you selected, and copied, will appear on the screen.

I'll start another post for the first few lines of code because, I could do with a cuppa, and you'll need to go and put your media in you project folder. (Unless of course, you already knew how to do that.) As always, if there's anything you don't understand, feel free to ask and I'll go over it again.

Formely code2kill
To tell you the truth, I'm just glad I DON'T enjoy playng The Sims.
the play2kill fan club
soapyfish
20
Years of Service
User Offline
Joined: 24th Oct 2003
Location: Yorkshire, England
Posted: 22nd Aug 2004 07:39 Edited at: 22nd Aug 2004 07:40
Right, now for some coding, the first few lines you'll need to type are....


set display mode 800,600,32
This command sets the display mode fore your game, similar to the way you can set the resolution for your monitor. the first number is the resolution across the screen, the second is the resolution up the screen, and the last is resolution in depth.

backdrop on
This command activates a 3d backdrop that fills the screen, you can then change the colour of the background from blue to black by typing....

color backdrop rgb(0,0,0)
This command colours the backdrop black, the colour is controlled by the rgb(red green blue) value (the numbers in the brackets) you can experiment with diiferent colours by changing these numbers, (255,0,0) would be red, (0,255,0) would be green, (0,0,255) would be blue and (255,255,255) would be white. If you want to find the correct numbers for a perticular colour you can try going into Paint (the program that came with windows) going to colors> edit colors> define custom colors. You see the numbers written next to Red: Green: and Blue: those are the numbers you can type into the brackets to get the colour you want. I've tried to illustrate this with a picture.


Well congrats, you've started to code your very own pong remake, in the next tut I'll start to use some of that media you put in your project folder, as always, if there's anything you don't understand just ask.

Your total code should now look something like this.


Formely code2kill
To tell you the truth, I'm just glad I DON'T enjoy playng The Sims.
the play2kill fan club
The dude guy
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: In the streets of sasatuin
Posted: 23rd Aug 2004 01:41
No questions.

Andrew Tamalunas
soapyfish
20
Years of Service
User Offline
Joined: 24th Oct 2003
Location: Yorkshire, England
Posted: 23rd Aug 2004 08:19 Edited at: 23rd Aug 2004 08:22
Good good,

Now for the next bit of code we're going to use something called a variable, this is a value that can be changed to affet the outcome of the program. These are usally written at the top of your code, just after you've set the screen up (which we've just done) thay have a name, and a value. You can miss a line or two if you want to make your code look neater and then type....


Here we have two variables, and because I've chosen a suitable name it's pretty easy to work out these are the x and y co-ordinates for the player. It's important to choose suitable names, heres an example, which piece of code is easier to understand.....



or.....



You get my point.

We now need to tell the computer that these variables are to be associated with the players sprite. So we need to write two commands......



load image "player_bat.bmp",1
This command tells the computer that we want it to look at the image of the players bat, the one we put in the project folder earlier.

sprite 1,player_x,player_y,1
This command tells the computer to take image number 1, and put that at the player_x and player_y co-ordinates, we then tell the computer this is sprite number 1, this is important because when we want to start moving the sprite etc we use the sprite number to tell the computer which sprite we are talking about.

There is an extra command which we can use.....


wait key
This command tells the computer to freeze exactly where it is, you will find this helpful for seeing if your code has worked until we begin on loops. If you place this at the bottom of your code and run it, you can see the player's bat displayed on screen.

Your code should now look similar to this......




Congratulations, now you've got a sprite on screen you've got something to show for all your effort, any problems, as always, just ask.

In the next tut we'll concentrate on moving your players bat/paddle and the rem command.

Formely code2kill
To tell you the truth, I'm just glad I DON'T enjoy playng The Sims.
the play2kill fan club
The dude guy
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: In the streets of sasatuin
Posted: 23rd Aug 2004 11:37
uh... It says error at line 14 could not load image or something like that.

Andrew Tamalunas
Ilya
21
Years of Service
User Offline
Joined: 10th Aug 2003
Location:
Posted: 23rd Aug 2004 11:48
Yes because there's no sprite_bat.bmp.
In the directory where you put the exe make a file called player_bat.bmp and edit it with notepad. Add this:

Now run the code.

The dude guy
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: In the streets of sasatuin
Posted: 23rd Aug 2004 12:00
That English?

Andrew Tamalunas
Ilya
21
Years of Service
User Offline
Joined: 10th Aug 2003
Location:
Posted: 23rd Aug 2004 12:08
Go to your DBP/temp directory.
Create a file called "sprite_bat.bmp".
Right-click on it and click edit.
Scribble on it.
Save it.
Close paint.
Rebuild the code.

soapyfish
20
Years of Service
User Offline
Joined: 24th Oct 2003
Location: Yorkshire, England
Posted: 24th Aug 2004 04:27
Hi,
Sorry, this is an error on my part, I'll have a go at uploading some new files to-night, if that doesn't work I'll e-mail them to you.

Formely code2kill
To tell you the truth, I'm just glad I DON'T enjoy playng The Sims.
the play2kill fan club
The dude guy
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: In the streets of sasatuin
Posted: 24th Aug 2004 04:30
okay.
andrewtamalunas@yahoo.com

Andrew Tamalunas
soapyfish
20
Years of Service
User Offline
Joined: 24th Oct 2003
Location: Yorkshire, England
Posted: 24th Aug 2004 08:24 Edited at: 24th Aug 2004 08:28
Hi,
sorry about that little problem, I've sent you an e-mail with the right sprites in, now onto actually moving them.

This is pretty easy once you understand what the commands do, in fact you can have the players bat/paddle moving up and down the screen with just a few lines of code. They are........



rem
rem is short for remark. When the computer sees rem it ignores whatever is written after it on the same line. You can see that I've used rem to write "comments" that will help other people understand what my code does, and will remind me what it does if I forget. You can write anything you want after a rem command, the computer will ignore it.

NOTE:: Instead of typing rem you could type ` this is the key underneath escape, and I alway use this instead of rem, but thats just because I want to, it makes absolutely no difference whatsoever, if I use rem or `

do loop
In a program like this it's safe to say do and loop go at the top and bottom of your code. Later on when your progams get more complicated they might appear all over the place, but by then you'll understand why they are where they are. The computer sees the word do and remembers where in your code it is, when it gets to the word loop it goes back to where it saw the word do and begins again, if the commands weren't there then program would get to the end of the code and end the program, just like it does now if you delete the wait key command.

if upkey()=1 and player_y>0 then player_y=player_y-1
This tells the computer to do something IF something else has happend. Here it is saying IF the upkey is being pressed AND the players y co-ordinates are more than 0, take 1 away from the players y co-ordinates. If the upkey isn't pressed or the players y co-ordinates are less than 0 the computer ignores the rest of that line. Try playing around with your code to see what happens, if you delete
you will be able to move the players bat/paddle off the top of the screen. If you change
to
The players bat/paddle will move down when the upkey is pressed.

if downkey()=1 and player_y<580 then player_y=player_y+1
This is much the same as the command we've just looked at except the computer only does what you want it to if the downkey is pressed and and the players y co-ordinates are more than 580, and instead of taking away 1 from the players y co-ordinates it adds 1.

sprite 1,player_x,player_y,1
If you don't put this command in the compiler won't tell you there's an error in your code, but nothing much will happen when you run it, you'll be able to your sprites but you won't be able to move them. This reminds the computer that player_y is to be associated with sprite 1 (the players bat/paddle)

Your complete code should now look something like this (I've added a few spaces between lines to make it look a little neater.)....



Now run your code and look at that little bat move.

Any problems, you know where to find me. Well, you don't, but you can post a message.

Formely code2kill
To tell you the truth, I'm just glad I DON'T enjoy playng The Sims.
the play2kill fan club
Hell Dragonz43
20
Years of Service
User Offline
Joined: 27th Jul 2004
Location: at home or at work
Posted: 24th Aug 2004 09:24
All those symbles are encrypted code. Did you try writing your own program yet?


www.freewebs.com/mycomputergames
The dude guy
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: In the streets of sasatuin
Posted: 24th Aug 2004 10:10
No. But! This tutorial is helping me!

Andrew Tamalunas
The dude guy
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: In the streets of sasatuin
Posted: 24th Aug 2004 11:34
Sorry. But it still says cannot load image at line 14!

Andrew Tamalunas
Hell Dragonz43
20
Years of Service
User Offline
Joined: 27th Jul 2004
Location: at home or at work
Posted: 24th Aug 2004 12:23
Ok, im going to write a "DBP FOR DUMMIES" (as u wanted before). You can find it on my website (www.freewebs.com/MyComputerGames) as soon as im done with it. It will be under tutorials.


www.freewebs.com/mycomputergames
The dude guy
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: In the streets of sasatuin
Posted: 24th Aug 2004 12:26
Thanks. Lol.

Andrew Tamalunas
Hell Dragonz43
20
Years of Service
User Offline
Joined: 27th Jul 2004
Location: at home or at work
Posted: 24th Aug 2004 13:49 Edited at: 24th Aug 2004 13:50
No prob. Just worked on it for about an hour, 1/50 done lol. Just kidding. Im gona post some tomorrow.


www.freewebs.com/mycomputergames
soapyfish
20
Years of Service
User Offline
Joined: 24th Oct 2003
Location: Yorkshire, England
Posted: 24th Aug 2004 19:58
Quote: "Sorry. But it still says cannot load image at line 14!
"


Are you keeping all the file names etc the same, if you don't mind posting your code I could have a look at it and tell you what the problem is.

Formely code2kill
To tell you the truth, I'm just glad I DON'T enjoy playng The Sims.
the play2kill fan club
The dude guy
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: In the streets of sasatuin
Posted: 25th Aug 2004 01:15


Andrew Tamalunas
soapyfish
20
Years of Service
User Offline
Joined: 24th Oct 2003
Location: Yorkshire, England
Posted: 25th Aug 2004 02:05 Edited at: 25th Aug 2004 02:06
It works for me, all I can think of saying is make sure all your images are in the PONG project folder and make sure all the file names are the same as those in your code.

Formely code2kill
To tell you the truth, I'm just glad I DON'T enjoy playng The Sims.
the play2kill fan club
The dude guy
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: In the streets of sasatuin
Posted: 25th Aug 2004 02:32
Oh... Thanks the sprites were in another folder.

Andrew Tamalunas
The dude guy
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: In the streets of sasatuin
Posted: 25th Aug 2004 10:30
Okay. I'm ready.

Andrew Tamalunas
soapyfish
20
Years of Service
User Offline
Joined: 24th Oct 2003
Location: Yorkshire, England
Posted: 25th Aug 2004 10:39 Edited at: 25th Aug 2004 10:43
Right then, on with the tut.

You've now managed to set up your project folder, set up the screen, load a sprite, position it on the screen and use the arrow keys to move it.

Now's probably a good time to load the rest of the sprites, doing this uses the same commands as we used to position the bat/paddle so I'll post the code and then explain some of the diffeences but won't go into as much detail as last time as you'll probably understand most fo what I write already.




You already know that we use the load image command, followed by the file name to get the computer to look at the picture we want.

We then tell the computer where we want to put that image on screen by telling the computer the x and y co-ordinates of that perticular sprite.

Just remember that no two sprites can have the same sprite number or at least not in this program.

Well this has been a bit of a short adition but most of what I've put has been talked about in earlier tuts, if there's anything you don't understnad just say and I'll try to go over it in more detail. In the next tut we'll concentrate on getting the ball to move around the screen.

Your complete code should now look like this......


Ofcourse it's probably a good idea to add some comments (using rem or `) to remind yourself what some of the commands do.

Formely code2kill
To tell you the truth, I'm just glad I DON'T enjoy playng The Sims.
the play2kill fan club
The dude guy
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: In the streets of sasatuin
Posted: 25th Aug 2004 10:41
What does 3,0,30,3 that mean in the sprite part?

Andrew Tamalunas
soapyfish
20
Years of Service
User Offline
Joined: 24th Oct 2003
Location: Yorkshire, England
Posted: 25th Aug 2004 10:47
When we load an image using.....



load image "horizontal_wall_top.bmp",3
We are telling the computer to load the image called horizontal_wall_top, we are then telling the computer that this is image number three.

sprite 3,0,30,3
We are now telling the computer that we want to make a new sprite, and that we want it to be sprite number three, we then tell the computer that we want the x co-ordinates of this sprtie to be 0 and the y co-ordinates to be 30. Finally we tell the computer that we want image number 3 to be this sprite.

Hope that helps.

Formely code2kill
To tell you the truth, I'm just glad I DON'T enjoy playng The Sims.
the play2kill fan club
The dude guy
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: In the streets of sasatuin
Posted: 25th Aug 2004 10:49
Could not load image at line 21.

Andrew Tamalunas
The dude guy
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: In the streets of sasatuin
Posted: 25th Aug 2004 10:51
It started working when I changed them from PNG to BMP.

Andrew Tamalunas
Hell Dragonz43
20
Years of Service
User Offline
Joined: 27th Jul 2004
Location: at home or at work
Posted: 25th Aug 2004 10:56
I posted some tutorials on my website... Have a look if u want.


www.freewebs.com/mycomputergames
The dude guy
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: In the streets of sasatuin
Posted: 25th Aug 2004 10:59
Uh... Hell Dragonz43, check you're thread.

Andrew Tamalunas
The dude guy
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: In the streets of sasatuin
Posted: 26th Aug 2004 01:19
So... Play2kill what's next?

Andrew Tamalunas
soapyfish
20
Years of Service
User Offline
Joined: 24th Oct 2003
Location: Yorkshire, England
Posted: 26th Aug 2004 01:41
Quote: "It started working when I changed them from PNG to BMP"


Oh yeah, I thought I'd made them all bmp, sorry about that. I'll post the next tut a.s.a.p, sorry if it seems like you have to wait ages for each addition but bear in mind I'm working at completely different times to you, (going on 2 a.m. in the morning when I posted that one last night.)

Formely code2kill
To tell you the truth, I'm just glad I DON'T enjoy playng The Sims.
the play2kill fan club
The dude guy
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: In the streets of sasatuin
Posted: 26th Aug 2004 01:46
Yeah. It's okay. Anyways you can make your own games so that's probably why it's taking you a while. And I know you're in a different timeline.

Andrew Tamalunas
soapyfish
20
Years of Service
User Offline
Joined: 24th Oct 2003
Location: Yorkshire, England
Posted: 27th Aug 2004 10:25 Edited at: 27th Aug 2004 10:27
Hi,
sorry for the long wait, been a little busy lately, anyhoo, les get on to moving the ball around the screen.

First of all I'm just going to mention a little about variables, you can give a variable any value you want but even the slightest difference can make all the difference. When moving our ball we want it to go fast enough to be a challenge for the player but not so fast you can never get to it. I find a good speed is 0.75 if you want to use a decimal (0.75, 1.435., 78.123 etc) the name of the variable has to be followed by a #

We want to move our ball so first of all we need to make variables for its x and y positions, place this piece of code with your other varibles outside of the loop.....



ball_x#=100, ball_y#=100
You can see here I've added a # to the end of the variable names because I plan on increasing these by a decimal number.

You now need to add these variabls to the sprite command just like we did for the bat/paddle, so change......



to......



sprite 6,ball_x#,ball_y#,6
This is just the same as we did for the bat/paddle, I am telling the computer to associate ball_x# and ball_y# with the ball sprite.

Now we actually want to see the ball moving. For the bat/paddle we only wanted it to move if one of the arrow keys was pressed, which is why we used the IF command, we want the ball to always be moving so in the loop we put......



We don't put an IF command for this, whenever the computer sees this it will move the ball 0.75 right and 0.75 up no matter what is happening.

Finally we need to remind the computer that ball_x# and ball_y# are connected to the ball, just like we did with the bat/paddle, put.....



near the end of your code.

Your completed code should now look something like this.....



Run your code and you can see the ball move up diagonally, delete the ball_y#=ball_y#+0.75 command and see what happens, you should then be able to work out what happens if you delete the ball_x#=ball_x#+0.75 command and why.

If you need help with any of this just say. In the next tut we'll concentrate on stopping the ball from passing through the walls.

Formely code2kill
To tell you the truth, I'm just glad I DON'T enjoy playng The Sims.
the play2kill fan club
The dude guy
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: In the streets of sasatuin
Posted: 27th Aug 2004 10:38
Thanks can't wait for the next part! and please change the png to bmp!

Andrew Tamalunas
Mr Fraggs
20
Years of Service
User Offline
Joined: 17th Oct 2003
Location: US
Posted: 28th Aug 2004 14:52
Are you still looking for a xtremely simple game tutorial ? if i get a response ill post one or ill post one anyways 2morrow
The dude guy
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: In the streets of sasatuin
Posted: 29th Aug 2004 00:43 Edited at: 29th Aug 2004 00:47
Uh... Sure. Don't post it email me it. I'd like to finish play2kill's tutorial before anyone else posts one.

The darkBASIC book came in from the library! If you want that book I'd suggest looking in a library! And if the library doesn't have it... Order it! (from the library)

Andrew Tamalunas

Login to post a reply

Server time is: 2024-09-23 01:16:46
Your offset time is: 2024-09-23 01:16:46