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 / fps shooter code

Author
Message
dax24
20
Years of Service
User Offline
Joined: 2nd Feb 2004
Location:
Posted: 5th Feb 2004 14:42
hi, i have been looking through this code and pretty much understand the mathmatics of the coding but the one think i dont know is the FLOAT command how does this work as i couldnt find it in the dbpro manual or help file?

http://gamespace.thegamecreators.com/?m=forum_view&t=24813&b=6
Ultimate
20
Years of Service
User Offline
Joined: 1st Nov 2003
Location:
Posted: 5th Feb 2004 18:43
FLOAT defines a type of number eg. an INTEGER is a whole number. Look it up on any wensite to do with programming, it is pretty standard no matter what the language.

In a world without leaders, who'd start all the wars?
Sparda
20
Years of Service
User Offline
Joined: 13th Jan 2004
Location: Pacifica
Posted: 8th Feb 2004 20:09
Don't bother with float, use real numbers by declaring them with a # symbol after the variable name; eg: number#=3.141
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 8th Feb 2004 22:13
Konrad, that's pretty strict advice, I'd like to hear why you suggested that to dax24 ?

-RUST-
"What the... Mooooooooooo!"
the_winch
21
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 8th Feb 2004 22:40
The info is a bit hard to locate in the dbpro help files.
Help > main menu > principles > data types and variables.
That help pages refers to floats as reals for some reason.

There is also a tutorial specifically about the data types in dbpro.
http://developer.thegamecreators.com/?f=dbpro_tutorials

Our civilization faces three great dangers. The first is destruction by a nuclear war, the second is being crippled with overpopulation and the third is the Age of Leisure.
Jonny_S
21
Years of Service
User Offline
Joined: 10th Oct 2002
Location: United Kingdom
Posted: 8th Feb 2004 22:42
Yeh I would like to know aswell, I've always thought as Float and Real being the same (they may take up different amounts of memory im not sure ) This also brings up another point which I never thought about until now what about if you add a '#' to a variable but then declare it as an integer? does it get over written?

Example

Global Number# as integer

I've personally always used floats but maybe after you explaining why using real numbers is better i'll change

Supermonkey - The crime gifhting sex god monkey!
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 8th Feb 2004 22:56
There is no difference between a real and a float in DBPro.

When you define a variable with a # as an integer, it gets treated as an integer.

For free Plug-ins, source and the DBPro Interface library for Visual C++ 6 and .NET
http://www.matrix1.demon.co.uk
Hamish McHaggis
21
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 8th Feb 2004 23:12
I declare the variable as float in this example (and always) as the editor (Twilight) I use can list the variables that I have declared, so I can see them easily. I can also refer to the code to see the variables. I completely disagree with konrad, it's bad practice not to declare variables.

Do you bite your thumb at me sir?
The Basics of DBPro Tutorial, on my site now!
Athelon XP 1600 Plus (1.4ghz) - ATI Radeon 9600 Pro - 256mb RAM
Jonny_S
21
Years of Service
User Offline
Joined: 10th Oct 2002
Location: United Kingdom
Posted: 9th Feb 2004 00:28
Yeh I never used to declare variables, but now I use alot of functions so I always declare them, but I'm straying off topic.

Supermonkey - The crime gifhting sex god monkey!
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 9th Feb 2004 01:19 Edited at: 9th Feb 2004 01:20
These were the 2 points I was getting at:

from IanM:
Quote: "There is no difference between a real and a float in DBPro.
"


from Hamish:
Quote: "I completely disagree with konrad, it's bad practice not to declare variables"


I couldn't agree more and would take these points a slight step further and would say that you should always try and use some form of Hungarian Notation (imho)

intMyVar as Integer
fltMyVar as Float
etc

-RUST-
"What the... Mooooooooooo!"

Login to post a reply

Server time is: 2024-09-21 21:09:11
Your offset time is: 2024-09-21 21:09:11