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 / Need help with movement

Author
Message
Ad87am
19
Years of Service
User Offline
Joined: 4th Aug 2005
Location: England / London
Posted: 7th Aug 2005 22:39
I am creating a game were i control a batton (rectangle) at the bottom and there is a ball which is moving around and there are lots of blocks to destroy with the ball, just like "alley way". The problem I am having is that I am having trouble getting the movement to go left and right, i can get it to go up and down, but the only way i can get it to go left and right is to write in the "move object "if rightkey()=1 then move object 1,1". I need to set a number so it cant pass it so it can not go off the screen. I have put in my code, can someone help plz? In this code when the right key is pressed, the object moves down.

Ad87am
19
Years of Service
User Offline
Joined: 4th Aug 2005
Location: England / London
Posted: 7th Aug 2005 22:57
Dunno y the code didnt work. Here it is

sync
loop


Set display mode 800,600,32

Sync on
Sync rate 40

`Create Objects--------------------------
Make object Box 1,1,1,7
Make Object Sphere 2,1

`-----------------------------------------



Color Object 1, RGB(40,155,70)
Color object 2, RGB(246,238,7)
Turn object left 1,88



`----------------------------------------
Do

Position Object 1,0,-20, Playerpos#
Position Camera 1,20,20
Point Camera 0,0,0


if rightkey()=1 then playerpos#=playerpos#+1


Sync
Loop
`----------------------------------------

master programmer
19
Years of Service
User Offline
Joined: 30th May 2005
Location: 3D Space
Posted: 8th Aug 2005 07:17 Edited at: 8th Aug 2005 07:23
It's moving down? You're using the z axis though? Wouldn't it be better to just use the y axis to move up and down and the x to move left and right? I think its because you rotated the object.

All right. Do you want to make boundaries so that the ball doens't go off the screen? If so, the tutorial on Pong may help with that. Also, you should just increase the x value and decrease it to move left and right, and incread/decrease the y value to move up and down. If you need more help, just post here again, I'll be glad to help.

Ad87am
19
Years of Service
User Offline
Joined: 4th Aug 2005
Location: England / London
Posted: 8th Aug 2005 18:27
I am not sure how to do the bit about the y axis. I know that the first number is the name of theobject, the second is X, then Y, then X. Do i just have to take out the Y and put the X back. So it would be

Position Object 1,,-20, 0, Playerpos# ?????

Login to post a reply

Server time is: 2024-11-27 21:34:32
Your offset time is: 2024-11-27 21:34:32