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 / 2D Left/Right Movement

Author
Message
Zyronagon
16
Years of Service
User Offline
Joined: 6th Mar 2008
Location: USA
Posted: 17th Oct 2009 01:05
(Dark Basic Pro) I'm making a simple 2D shooter, like Raiden or Xevious but not as fancy, and I'm stuck on left/right movement. I can use the MOVE SPRITE command to enable up/down (Y Axis) movement, but I don't see how I can move the sprite left or right without rotating it. How do you do this?
Zyronagon
16
Years of Service
User Offline
Joined: 6th Mar 2008
Location: USA
Posted: 17th Oct 2009 02:32
Is there some way you can use the Offset Sprite command?
cheese pwner
15
Years of Service
User Offline
Joined: 26th Oct 2008
Location:
Posted: 17th Oct 2009 03:42
i am not by a compiler now but something like this should work


If it moves too fast then lower the values that are not 0. If it goes backwards then change the negative values to positive and the positive values to negative. If any more problems exist just post
Zyronagon
16
Years of Service
User Offline
Joined: 6th Mar 2008
Location: USA
Posted: 17th Oct 2009 03:54
That would just change the object's postion (also, it's a sprite, not an object).
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 17th Oct 2009 07:50 Edited at: 17th Oct 2009 07:50
use controls to add/subtract to/from current x/y values to get new x/y values. ie,:



good luck


Izzy545
20
Years of Service
User Offline
Joined: 18th Feb 2004
Location:
Posted: 24th Oct 2009 21:46
If you want a tutorial for beginners on how to move a user controlled sprite around the screen, here's a link to a series I've been working on:

http://dbprotutorials.wordpress.com/2009/10/15/tutorial-1-1-hello-world/

Neuro Fuzzy
17
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 25th Oct 2009 03:11
use the "sprite" command each frame. The sprite command creates a sprite or moves it (depending on if it's been created already). If you still don't get it, you should familiarize yourself with variables first. You should be able to understand this code:
Zyronagon
16
Years of Service
User Offline
Joined: 6th Mar 2008
Location: USA
Posted: 28th Oct 2009 01:08
Thanks Neuro Fuzzy! Saved me alot of banging my head against this desk.

Login to post a reply

Server time is: 2024-09-28 12:21:10
Your offset time is: 2024-09-28 12:21:10