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.

DarkBASIC Discussion / need help with movement

Author
Message
DaedalusX
21
Years of Service
User Offline
Joined: 10th Mar 2004
Location:
Posted: 25th Sep 2004 20:28
im making a 2d rpg but thier is something wrong with positioning the main sprite. i set the sprite with 'sprite 1,200,50,1 which it does but later i had to add the code 1,x,y,1 to update the movement problem is it bypasses the position i set at the beggining is thier a altewrnative to this? the source is included


Daedalus
Xander
22
Years of Service
User Offline
Joined: 3rd Mar 2003
Location: In college...yeah!
Posted: 27th Sep 2004 10:14
Whenever you call the sprite command, it will update the sprite's position and texture. If you want to update its texture without changing its position, do the following:



Replace the image number with whatever you want...

Is this what you meant? If not, sorry, I didn't quite understand, please be more specific...

Xander Moser - Bolt Software - Firewall
DaedalusX
21
Years of Service
User Offline
Joined: 10th Mar 2004
Location:
Posted: 29th Sep 2004 06:44
not quite it now positions the sprite where i want it but wont move. sorry im not too good at explaining. this is drivcing me crazy lol

Daedalus
SandraD
20
Years of Service
User Offline
Joined: 30th May 2004
Location: Down on the corner, out in the street.
Posted: 29th Sep 2004 10:09
To move a sprite, simply use the sprite command with the new location values;

for x = 0 to screen width()
sprite 1, x, 50, 1
sync
wait 50 : ' pause for visual display
next x

This will make the sprite move across the screen at line 50...

Any truly great code should be indisguishable from magic.
X_MEN
21
Years of Service
User Offline
Joined: 14th Sep 2003
Location:
Posted: 30th Sep 2004 11:35
x=200
y=50
do
if upkey()=1 then y=y-13
if downkey()=1 then y=y+13
if leftkey()=1 then x=x-13
if rightkey()=1 then x=x+13


sprite 1,x,y,1
sync
loop


You can do it if you try
DaedalusX
21
Years of Service
User Offline
Joined: 10th Mar 2004
Location:
Posted: 2nd Oct 2004 03:57
IT WORKS !!!!!!!!!!!!! thanks a lot guys i cant believe something that simple killed my project for such a long time

Daedalus
SandraD
20
Years of Service
User Offline
Joined: 30th May 2004
Location: Down on the corner, out in the street.
Posted: 2nd Oct 2004 13:58
< S M I L E S ! >
Glad to be of help.
S.

Any truly great code should be indisguishable from magic.

Login to post a reply

Server time is: 2025-05-25 03:46:17
Your offset time is: 2025-05-25 03:46:17