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 / primary noob...please help

Author
Message
Asternus
20
Years of Service
User Offline
Joined: 11th Aug 2004
Location: N.C. U.S.A
Posted: 12th Aug 2004 11:10
Hello all. I am fairly new to programming. The only skills I have are on winamp5 skins,(not really programming,but I got an idea).I wanted to start off simple.

Make a couple of cubes position them on the screen -- Done That.
Take the cubes and spin them -- Done That.
Make the cubes move up and down, then left and right -- Can't do it.

So any help would be nice.
MR AI
20
Years of Service
User Offline
Joined: 24th Jan 2004
Location:
Posted: 12th Aug 2004 11:50
dark basic classic or pro
not that it make much difference to the question
Enclosed
20
Years of Service
User Offline
Joined: 8th Jun 2004
Location: Colorado
Posted: 12th Aug 2004 15:08
Heres my wicked cool version

I didnt make them stop then go different directions because I'm lazy and if you understand mine then you can do it yourself
Dodo
20
Years of Service
User Offline
Joined: 8th Aug 2004
Location: eating lunch
Posted: 12th Aug 2004 22:18
Why not try adding user inputs into it Asternus. this code makes cubes and textures, textures the cubes and then takes user inputs to move and rotate the cubes. the arrow keys move the cubes and pressing control and the arrowkeys rotates the cubes (both in opposite directions)

Asternus
20
Years of Service
User Offline
Joined: 11th Aug 2004
Location: N.C. U.S.A
Posted: 13th Aug 2004 01:06
Yes, Enclosed, that works.Thanks.
I am using DBP. So variables make all the difference when positioning objects? I haven't really gotten to using keystrokes to move them yet...
To make the cubes start at the top of the screen and drop to the bottom I need to put a variable in "Y"?...
I looked at one of the pong tuts and that just confused me.I couldn't figure out where they got the position.
I'll try tonight and hopefully get somewhere.
Thanks people.
Enclosed
20
Years of Service
User Offline
Joined: 8th Jun 2004
Location: Colorado
Posted: 13th Aug 2004 03:02
The thing is code reads like a person does(at least I like to picture it that way) left to right top to bottom. However when we do certain things to code it reads differently like when the code reaches a command LOOP it goes back up to the DO that it is paired with and then back down over and over... SO every time we go through the DO LOOP I defined a variable(Y) to be different and then placed the object at variable(Y). Therefore every time the code went through the DO LOOP the object was positioned at a different point. A simpler example would be:

However I did not stop xposition# from getting too big so it left our sight. To fix this I would add a command that makes it so xposition# does not get bigger then lets say 5. So I set up an if command so that if xposition# is less then 5 we can add .01 to xposition. ANd that would end up looking like this:

Now I believe you can fully understand my code and how I used variables and IF statements in combination to keep the boxes within a certain area and constantly moving. Hope this helps. Anymore questions about this?
Asternus
20
Years of Service
User Offline
Joined: 11th Aug 2004
Location: N.C. U.S.A
Posted: 15th Aug 2004 01:38
Thank you all.I rewrote my blocks and I've got the hang of it.
Here is my bouncing cubes.Now,to get them to move at different speeds,wouldn't I have to make a different variable for each?
Asternus
20
Years of Service
User Offline
Joined: 11th Aug 2004
Location: N.C. U.S.A
Posted: 15th Aug 2004 01:39
make()
y#=28
yy#=-59

sleep 1000
sync on:do
if y#>28 then reverseY=1
if y#<-51 then reverseY=0
if reverseY=1 then y#=y#-0.4
if reverseY=0 then y#=y#+0.4
if yy#<-59 then reverseYY=0
if yy#>27 then reverseYY=1
if reverseYY=0 then yy#=yy#+0.4
if reverseYY=1 then yy#=yy#-0.4
if object hit (1,9) then reverseY=0 and reverseY=1
if object hit (9,1) then reverseYY=1 and reverseYY=0


``First Line
position object 1,-53,y#,70:rotate object 1,1,object angle y(1)+1,0
position object 2,-37,y#,70:rotate object 2,1,object angle y(2)+1,0
position object 3,-22,y#,70:rotate object 3,1,object angle y(3)+1,0
position object 4,-8,y#,70:rotate object 4,1,object angle y(4)+1,0
position object 5,6,y#,70:rotate object 5,1,object angle y(5)+1,0
position object 6,20,y#,70:rotate object 6,1,object angle y(6)+1,0
position object 7,34,y#,70:rotate object 7,1,object angle y(7)+1,0
position object 8,49,y#,70:rotate object 8,1,object angle y(8)+1,0
``Second Line
position object 9,-53,yy#,70:rotate object 9,1,object angle y(9)+1,0
position object 10,-37,yy#,70:rotate object 10,1,object angle y(10)+1,0
position object 11,-22,yy#,70:rotate object 11,1,object angle y(11)+1,0
position object 12,-8,yy#,70:rotate object 12,1,object angle y(12)+1,0
position object 13,6,yy#,70:rotate object 13,1,object angle y(13)+1,0
position object 14,20,yy#,70:rotate object 14,1,object angle y(14)+1,0
position object 15,34,yy#,70:rotate object 15,1,object angle y(15)+1,0
position object 16,49,yy#,70:rotate object 16,1,object angle y(16)+1,0

sync:loop

function load()
load image "Img 0.jpg",1
load image "Img 1.jpg",2
load image "Skull.jpg",3
endfunction

function make()

make object cube 1,10
make object cube 2,10
make object cube 3,10
make object cube 4,10
make object cube 5,10
make object cube 6,10
make object cube 7,10
make object cube 8,10
make object cube 9,10
make object cube 10,10
make object cube 11,10
make object cube 12,10
make object cube 13,10
make object cube 14,10
make object cube 15,10
make object cube 16,10
endfunction
Asternus
20
Years of Service
User Offline
Joined: 11th Aug 2004
Location: N.C. U.S.A
Posted: 15th Aug 2004 01:40
say when I position them...
position object 1,-53,y1#,70:rotate object 1,1,object angle y(1)+1,0
position object 2,-37,y2#,70:rotate object 2,1,object angle y(2)+1,0
and increase or decrease the movement.
Sir Spaghetti Code
20
Years of Service
User Offline
Joined: 12th Jul 2004
Location: Just left of Hell
Posted: 15th Aug 2004 01:46
May I suggest doing the tutorials for DB? Peep the link:http://darkbasic.thegamecreators.com/?f=tutorials That is where I started and it really helped me!

"I attribute the quarrelsome nature of the Middle Ages young men entirely to the want of the soothing weed."
-Jerome K. Jerome(1859-1927),Writer
Asternus
20
Years of Service
User Offline
Joined: 11th Aug 2004
Location: N.C. U.S.A
Posted: 15th Aug 2004 08:45
i'll give it a shot
Asternus
20
Years of Service
User Offline
Joined: 11th Aug 2004
Location: N.C. U.S.A
Posted: 15th Aug 2004 10:02
just for the sake of argument...
could I use an array or a "for" command to save some space when
positioning objects?
Dodo
20
Years of Service
User Offline
Joined: 8th Aug 2004
Location: eating lunch
Posted: 15th Aug 2004 21:05 Edited at: 15th Aug 2004 21:05
yeah, u could use a "for" command e.g.



p.s. i added in the sync rate command cos it ran too fast on my computer
Asternus
20
Years of Service
User Offline
Joined: 11th Aug 2004
Location: N.C. U.S.A
Posted: 15th Aug 2004 21:24
Thought so.Thanks
Asternus
20
Years of Service
User Offline
Joined: 11th Aug 2004
Location: N.C. U.S.A
Posted: 19th Aug 2004 22:28 Edited at: 19th Aug 2004 22:34
Well I got the cubes to do what I wanted.Now I want the camera to have a limit,just not sure how to stop it.
Here is the full code.
Asternus
20
Years of Service
User Offline
Joined: 11th Aug 2004
Location: N.C. U.S.A
Posted: 19th Aug 2004 22:30 Edited at: 19th Aug 2004 22:35
edit!!

Login to post a reply

Server time is: 2024-09-22 21:25:29
Your offset time is: 2024-09-22 21:25:29