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 / sprite movement

Author
Message
rockabillypete
21
Years of Service
User Offline
Joined: 3rd Jan 2003
Location:
Posted: 9th Jan 2003 23:36
HI can anyone help me with this
i want to move left and right but all i get is up and down
i tried rotate sprite but it just jumped accross screen.
a code snippet would be good. and how do u instert one of them here. sorry just seen code above .

many thanx

sync on :sync rate 60
x=200: y= 200
load image "C:\pic.JPG" ,1
sprite 1,x,y,1
do
if upkey()=1 then move sprite 1,10
if downkey()=1 then move sprite 1,-10
if leftkey()=1 then move sprite 1,10
if rightkey()=1 then move sprite 1,-10
sync
loop
wait key
music is life
cybersamurai
21
Years of Service
User Offline
Joined: 2nd Jan 2003
Location:
Posted: 9th Jan 2003 23:45
to utilize the code tags use [code.][/code.] or highlight it and click on the code button

to move up and down i would use inc and dec on the x axis.

if leftkey()=1 then dec x,4
if rightkey()=1 then inc x,4
if upkey()=1 then dec y,4
if downkey()=1 then inc y,4

I don't know about the move sprite command so i cannot help you there...

Must Steal all of the bran muffins in the world...

-Rusty Gears
rockabillypete
21
Years of Service
User Offline
Joined: 3rd Jan 2003
Location:
Posted: 9th Jan 2003 23:50
thanks but i dont think this will help with sprite as its written.

music is life
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 10th Jan 2003 00:09
This is what he meant:



What I think you actually want is this


Heh, please excuse my choice of image
rockabillypete
21
Years of Service
User Offline
Joined: 3rd Jan 2003
Location:
Posted: 10th Jan 2003 15:06
Now thats what i call help number 90000000 lol
brill cheers
not sure what wrap means have to look it up
up and down work fine just didnt understand why L and R didnt.

music is life
rockabillypete
21
Years of Service
User Offline
Joined: 3rd Jan 2003
Location:
Posted: 10th Jan 2003 19:05
i tried this and it seems to be like a clock. i wanted just to move left. like space invaders

music is life
rockabillypete
21
Years of Service
User Offline
Joined: 3rd Jan 2003
Location:
Posted: 10th Jan 2003 19:15
cheers works fine brill so simple when you know how
next i got to work out col sprite

music is life
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 10th Jan 2003 20:33
wrapvalue ensures that the value stays in the range 0 to 359. This keeps angles at reasonable values.
rockabillypete
21
Years of Service
User Offline
Joined: 3rd Jan 2003
Location:
Posted: 10th Jan 2003 21:18
All i wanted at the time was up down left and right done it now thanks. i will start wrap soon when i understand all other stuff. wrote 2 small games now i will have to put score next. i think this is the best basic ive ever used to get stuff done.
cheers everybody and a happy new year

music is life

Login to post a reply

Server time is: 2024-11-23 21:33:26
Your offset time is: 2024-11-23 21:33:26