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 / Gosub with a jumping code doesnt' work

Author
Message
Xlaydos
20
Years of Service
User Offline
Joined: 26th Mar 2004
Location:
Posted: 11th May 2005 03:19 Edited at: 11th May 2005 03:20
I have this jumping code



But if i do this



Then it does not work

Thanks for your help
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 11th May 2005 03:45
So the first code works? I don't see any problems..
Xlaydos
20
Years of Service
User Offline
Joined: 26th Mar 2004
Location:
Posted: 11th May 2005 04:01
I prefer to sort my code into neat sections
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 11th May 2005 05:10
When you say it doesn't work, what actually happens?

By the way, you can simplify:

VertSpeed#=(VertSpeed#+Gravity#)

to

inc VertSpeed#, Gravity#

BatVink
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 12th May 2005 04:26
And make sure Gravity# > 0.0 !!!
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 12th May 2005 05:20
I havent read the code but in a few days my basic engine will be out and it includes dynamic gravity and jumping...If you can wait a few days it might be able to help you, I dont know. Ofcourse it might be longer than a few days but Id give it about 5...which is more like a week I guess. Ack Ill shut up now.

Xlaydos
20
Years of Service
User Offline
Joined: 26th Mar 2004
Location:
Posted: 12th May 2005 05:30
@Batvink Gravity = -2

@Ruccus My code works if it is the main loop but not if it is in a gosub
Clueless
20
Years of Service
User Offline
Joined: 16th Feb 2004
Location: Corbin, KY, USA
Posted: 12th May 2005 09:35
Quote: "main loop but not if it is in a gosub "


Are the variables referenced in the subroutine global? It almost sounds like your gravity and vertical speed vars are local variables in the subroutine.
master programmer
19
Years of Service
User Offline
Joined: 30th May 2005
Location: 3D Space
Posted: 30th May 2005 17:46
I don't see any problems either, but it looks messy and can be simplified. Besides that, the only thing I see that I would do different is change the "gosubs" from "Jumping_:" to "_Jumping:"

_________________________________
<<<<I can program using anything>>>>

Login to post a reply

Server time is: 2024-09-23 19:22:37
Your offset time is: 2024-09-23 19:22:37