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 / er, need help on dark basic

Author
Message
mog_squad
21
Years of Service
User Offline
Joined: 22nd Sep 2003
Location:
Posted: 8th Dec 2003 20:42
im making a 2d fighter, kinda like street fighter, except with stick figgures, heh, and i was wondering, how do you get the images to move, ie, by pressing the left key, your fighter moves left. I worked out jumping, but now, whenever i press the right key to move my character, he moves right, and bounces back, as if he was jumping to the right or something. A code for basic movement whould be nice.
If there is one, i need a code that changes an immages position by pressing a key, like, its x position increases by 20 or something... If anyones confused, im sorry, lol

DONT @$#%#@$% MESS WITH ME! I'll kupo your @$$!
John H
Retired Moderator
22
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 8th Dec 2003 22:23
Xpos=100
YPos=100

Do

Sprite 1,Xpos,Ypos,1

If rightkey()=1 then inc Xpos,2
If leftkey()=1 then dec Xpos,2

Loop


Dont forget to Join the Forums!
HZence
21
Years of Service
User Offline
Joined: 9th Mar 2003
Location:
Posted: 8th Dec 2003 22:40 Edited at: 8th Dec 2003 22:42
To explain RPGamer's code...

Well I assume you understand the sprite command and it's syntax, ie:



Well, if you pay attention you'll notice that "50" and "150" are coordinates: X and Y (X being horizontal and Y being veritcal). Basically what you have to do is declare a variable for each coordinate, such as X and Y, and define them. for example:



You get it? Simple really. Now to move the sprite really all you have to do is alter the variable. For example, make it that if the user presses the right key, you'll want to move them right (or +1):



Keep in mind that you need to reposition the sprite (using the sprite command) every time you change it's coordinate, otherwise you'll have only altered the variable and done nothing with it! Also, it's assumable that you'll want to do this continually without the program abruptly ending. That's where you'll use a loop. Then you come up with something like this:



Hope that helps.

Team EOD :: Programmer/Storyboard Assistant
mog_squad
21
Years of Service
User Offline
Joined: 22nd Sep 2003
Location:
Posted: 9th Dec 2003 01:21
Thanks guys, you were a big help, now , on to creating
"STICK FIGHTER 2000!!!"
I dont have a model editor, so the best i can do now is make stick figures, lol.

thanks again.

DONT @$#%#@$% MESS WITH ME! I'll kupo your @$$!
mog_squad
21
Years of Service
User Offline
Joined: 22nd Sep 2003
Location:
Posted: 9th Dec 2003 01:58
Er, got a problem though, while testing it, whenever i pressed the right key, to move the character, the character whould dissaper. Everyonce and awhile it whould blink back in, but then dissapear again! Is there something i should do now?

DONT @$#%#@$% MESS WITH ME! I'll kupo your @$$!
HZence
21
Years of Service
User Offline
Joined: 9th Mar 2003
Location:
Posted: 9th Dec 2003 05:57
hm, wonder why this would be happening? post your code and i might be able to help you further.

Team EOD :: Programmer/Storyboard Assistant
Daris Xiao or Benjy Wright
20
Years of Service
User Offline
Joined: 13th Dec 2003
Location: Face first in a bowl of soup.
Posted: 13th Dec 2003 23:21
HEY! I knda think that mog_squad's quote thingy is inappropriate. I just think that a supervisor or someone should say something!
"@$$" does greatly resemble a vulgar expression, and my little brother uses this site too!
Doucan
20
Years of Service
User Offline
Joined: 26th Nov 2003
Location: Vermont USA
Posted: 14th Dec 2003 00:13
i agree

If you come to a fork in the road, take it!

-Yogi Berra
John H
Retired Moderator
22
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 14th Dec 2003 03:01
Yea Mog plz Edit that

DONT FREAKIN MESS WITH ME! I'll kupo your butt!


Dont forget to Join the Forums!
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 14th Dec 2003 03:31
hmm mog youve been outed mate the users have rebelled and its time for a new signature.
HZence
21
Years of Service
User Offline
Joined: 9th Mar 2003
Location:
Posted: 14th Dec 2003 18:10
oh relax people


Team EOD :: Programmer/Storyboard Assistant

Login to post a reply

Server time is: 2024-11-25 20:19:51
Your offset time is: 2024-11-25 20:19:51