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 / Movement issue - variables not changing when they should

Author
Message
Foxy
19
Years of Service
User Offline
Joined: 4th Jan 2005
Location: The Dale, South Australia
Posted: 14th Oct 2005 12:50
Hey all, I was tinkering around with a bit of code, and I decided to try and implement some acceleration code into it to move my little sphere around.

As far as I know, the code I have should work like a charm, to accelerate and decelerate, but for some reason, the rate# variable won't change when the up arrow key is pressed.

I've looked through this countless times and can't find a fault in it, maybe it's a bug with DBPro?

By the way, I'm using DBPro U5.8, I'm hesitating to upgrade to the beta version of U5.9 as I've read that it has some bugs in it still, if anyone can advise me otherwise then it would be appreciated.

I tried a much simpler version of this, without any media or anything using the same principle and it works fine

All the files required are included in the attatched .zip file.

Thanks.

Go to My Site
Formerly Durdge39

Attachments

Login to view attachments
The Nerd
20
Years of Service
User Offline
Joined: 5th Jun 2004
Location: Denmark
Posted: 14th Oct 2005 13:33 Edited at: 14th Oct 2005 13:40
I just fixed it i think. I don't know how fast you want the sphere to move, but now it accelerates to 1 nicely. The error was this bit of code:



Why do you declare it as an integer if it needs to be a float?

change it to this:


You should also change all the other "as integer" to this too, since i can see that there ment to be floats too.

See, integers can't store decimal numbers. That's what the data type Floats are for As i think you know, you declare a float with the sign #.

Well, here are the changed code. This works nicely :





PanzerGameshere
Free Particle Engine For dbpro :
here
Foxy
19
Years of Service
User Offline
Joined: 4th Jan 2005
Location: The Dale, South Australia
Posted: 14th Oct 2005 13:57
Wow man, thanks, it is much appreciated. I always thought that integers allowed for decimal points as well, learn something every day.

Thanks again!

Go to My Site
Formerly Durdge39
UFO
19
Years of Service
User Offline
Joined: 11th Oct 2005
Location:
Posted: 14th Oct 2005 16:53
That happened to me too.

Login to post a reply

Server time is: 2024-11-27 16:59:29
Your offset time is: 2024-11-27 16:59:29