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 / Auto creating boxes

Author
Message
Mavlock
18
Years of Service
User Offline
Joined: 11th Jan 2006
Location:
Posted: 12th Jan 2006 01:05
Can anyone tell me why this automatically goes to 6 and only creates one box? And movevar never increases.

thanks
The Nerd
20
Years of Service
User Offline
Joined: 5th Jun 2004
Location: Denmark
Posted: 12th Jan 2006 15:18
The source code button dosn't work.
Please use the code snippet tags





-The Nerd

Free Particle Engine for DarkBasic Pro:
http://forum.thegamecreators.com/?m=forum_view&t=60141&b=5
Mavlock
18
Years of Service
User Offline
Joined: 11th Jan 2006
Location:
Posted: 12th Jan 2006 20:10
Can anyone tell me why this automatically goes to 6 and only creates one box? And movevar never increases.

thanks

EDIT: Damn, thanks though. Here we go.

Mavlock
18
Years of Service
User Offline
Joined: 11th Jan 2006
Location:
Posted: 13th Jan 2006 08:32
Nevermind folks it looks like I figured it out.

Gyrich
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: Here, obviously.
Posted: 13th Jan 2006 10:40
well im not sure what your desired effect is, but it does seem like you need to put the "#" at the end of your variables throught the code, you only have it there when u first declare them (i.e.: change "boxcreate" to "boxcreate#"). try putting those in and see if that gives you what you want.

dunno what effect ur going for, but having that do loop in there is gonna create an infinitely long line of boxes heading to the right on the x-axis, and the boxes are partially inside one another so it looks like a 3d line getting longer and longer..

in any case here's your code the with the "#"s:



I threw in a camera to get a better view, just take it out if u don't need it.

well hoped i helped. later

DBPro User
PC: WinXP, AthlonXP 2100+ 1.7ghz, 80gb HD, Nvidia GeForce FX 5200 (128mb onboard RAM), 512mb DDR400 system RAM. Thank you for your help.
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 13th Jan 2006 11:41
Creating extra cameras is not a good idea as they are not needed in 99% of games and slow down frame rate.

Main problem is misunderstandinf of the variable types.

Integers (whole numbers), like 1, 5, 123 are denoted like a, b, score

Floats (fractions), like 1.2, 0.5, 34.567 are denoted like a#, x#

If you add a fractional value to an integer, you get a rounded value to lowest integer,

a=5
inc a#,0.5
print a
wait key

actually prints 5, not 5.5

So if a variable is only ever going to hold whole numbers, use variables like a, b, objnum, etc

and if a variable will hold fractional values, like your movevar, then you must define and use it is movevar#

There is a method that is commonly used to get rid of the #'s required all the time. Just define variable as a float with;

a as float
a=5
inc a,0.5
print a
wait key

Hope that helps.



Boo!
Mavlock
18
Years of Service
User Offline
Joined: 11th Jan 2006
Location:
Posted: 13th Jan 2006 16:43
Excellent. Thanks alot both of you. I didn't realize at first it would keep creating boxes till the end of time. So I moved it outside the main loop and the world is right now.
Floats.. dually noted.

Thanks again.
Gyrich
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: Here, obviously.
Posted: 13th Jan 2006 23:26
yeah spook i didn't know that extra cameras slowed down the frame rate, but i had just added in a camera so i could get a better view of what was going on when the program executed, with default camera, 1st box took up most of view. wanted to make sure that the other boxes weren't just out of the camera's viewing angle, but good to know that about extra cameras. adios

DBPro User
PC: WinXP, AthlonXP 2100+ 1.7ghz, 80gb HD, Nvidia GeForce FX 5200 (128mb onboard RAM), 512mb DDR400 system RAM. Thank you for your help.

Login to post a reply

Server time is: 2024-09-24 13:34:13
Your offset time is: 2024-09-24 13:34:13