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 / my first real bit of code [DBP]

Author
Message
tunners
14
Years of Service
User Offline
Joined: 23rd Aug 2010
Location: Leeds UK
Posted: 11th Sep 2010 04:21
I've been trying to work on a VERY basic platform engine this evening.

I've had no internet, thus no access to any tutorials other than the included help files with DBPro.

I managed to make a really really basic 2D platform engine with x movement and jumping. that's it.

however, I have the feeling that it's really sloppy and I don't understand why there are 2 of the same sprite on screen.

any guidance would be appreciated

Attachments

Login to view attachments
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 11th Sep 2010 22:55
Sprites draw themselves automatically every SYNC. You are pasting a second copy to the screen with PASTE SPRITE.

All that you need to do to fix this is replace this line:


with this line:


Utility plug-ins (26-JUL-2010)
I'm applying terms of use that require you to wear a red nose and honk a horn whenever you use the Internet
tunners
14
Years of Service
User Offline
Joined: 23rd Aug 2010
Location: Leeds UK
Posted: 12th Sep 2010 03:57 Edited at: 12th Sep 2010 15:04
Ahh absolutely fantastic, thanks! I think I misunderstood the documentation for DBP.

That's great though... I just need to start getting an understanding of map-making now

I added a bit more stuff to my code, added a sense of velocity when jumping, though if I decrease the movement speed below 0.5 the character just stops in midair or won't move anymore.

Is it because i'm mixing floats with integers?



also replaced rhea with a fancy block for now

Attachments

Login to view attachments
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 12th Sep 2010 15:40
The problem is in this block of code:



I have edited it so that it works, regardless of your xspeed; all you have to do is change this part of the code. I think you were getting stuck in an infinite loop here. It kept decrementing by 0.5, testing to see if it = 0.0, which it never would if you had decremented/incremented by a value other than 0.5 if rhea.direction = 1 or 2.

So many games to code.......so little time.
tunners
14
Years of Service
User Offline
Joined: 23rd Aug 2010
Location: Leeds UK
Posted: 15th Sep 2010 19:04
thanks a lot, big help works great now

Login to post a reply

Server time is: 2024-09-28 22:28:31
Your offset time is: 2024-09-28 22:28:31