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

Author
Message
hpfan273
19
Years of Service
User Offline
Joined: 19th Jan 2007
Location:
Posted: 18th Mar 2007 01:32
i am using DBC... and i want to know how to make it so that when you are playing the game, and you PRESS the up/down/left/right key, the character moves 32 pixals that way. i have done alot of searching... and couldn't find anything for DBC... so how would i go about doing this?

THANKS FOR STOPING AT A RED LIGHT... AND LETTING ME CRASH INTO YOU AT 80 MILES AN HOUR!!!
Quisco DaLuse
19
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: USA
Posted: 18th Mar 2007 02:10
You could try this:

if upkey()=1 and player_y>32 then player_y=player_y-32
if downkey()=1 and player_y<(screen height()-32)then player_y=player_y+32
if leftkey()=1 and player_x>32 then player_x=player_x-32
if rightkey()=1 and player_x<(screen width()-64) then player_x=player_x+32
sprite player,player_x,player_y,player_image

You idiots! You've captured their stunt doubles!
HeavyAmp
19
Years of Service
User Offline
Joined: 25th Oct 2006
Location: Castle in the Sky!
Posted: 18th Mar 2007 02:10
You will need to modify it to go up 32pixels and you will probably not want it to go up 32 pixels every time it loops.


hpfan273
19
Years of Service
User Offline
Joined: 19th Jan 2007
Location:
Posted: 18th Mar 2007 21:23
ok... here is my current code:

with this part of the code:

i want it so that my character doesn't keep moving if i hold down the up/down/left/or right keys... how? thanx for ur help though...

THANKS FOR STOPING AT A RED LIGHT... AND LETTING ME CRASH INTO YOU AT 80 MILES AN HOUR!!!
Quisco DaLuse
19
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: USA
Posted: 18th Mar 2007 23:51
Use the keystate of the arrow keys to control it. Use this code for your do - loop:



You idiots! You've captured their stunt doubles!
hpfan273
19
Years of Service
User Offline
Joined: 19th Jan 2007
Location:
Posted: 19th Mar 2007 01:07
it worked great!!! thanx!!!

THANKS FOR STOPING AT A RED LIGHT... AND LETTING ME CRASH INTO YOU AT 80 MILES AN HOUR!!!
Quisco DaLuse
19
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: USA
Posted: 19th Mar 2007 02:46
Np - glad to help.

You idiots! You've captured their stunt doubles!

Login to post a reply

Server time is: 2026-07-05 22:37:18
Your offset time is: 2026-07-05 22:37:18