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.

DarkBASIC Professional Discussion / Stop variable at certain number

Author
Message
MateiSoft Romania
12
Years of Service
User Offline
Joined: 16th Oct 2013
Location:
Posted: 20th Jun 2014 21:55
Hey community,

I want to make the camera move automatically but i want that the variable that is increasing to stop from 0 at a certain number lets say 0, how can i do that ?

Thank You very much!

I have this code but it doesn't work.



Alex Matei CEO
www.alexmatei.com
SamKM
17
Years of Service
User Offline
Joined: 25th May 2009
Location:
Posted: 20th Jun 2014 22:09
I think I get what you're looking for here! Do you mean you want to increase a variable until it reaches a certain number?
With this code:
[i[
if a# > 200
inc a#
endif
[/i]
You're saying 'If a# holds a value of more than 200, increase the value of a# by 1'. You should be able to get the effect you want by changing the code to 'if a# < 200', because that way you're saying 'if a# hold a value of less than 200, increase the value of a#'. That way, a# will increase until it reaches 200, then stop increasing
Hope that helps

The code never bothered me anyway...
MateiSoft Romania
12
Years of Service
User Offline
Joined: 16th Oct 2013
Location:
Posted: 20th Jun 2014 22:59
Yes, that helped thank you!

I wasn't paying attention to the <> signs.

Alex Matei CEO
www.alexmatei.com
MateiSoft Romania
12
Years of Service
User Offline
Joined: 16th Oct 2013
Location:
Posted: 20th Jun 2014 23:28
Also, do you know how can i turn the camera smoothly when reaching a certain number from a variable?

A big Thank You!

Alex Matei CEO
www.alexmatei.com
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 21st Jun 2014 01:16 Edited at: 21st Jun 2014 01:16
Maybe curveangle()? Otherwise you can just specify an increasing variable on the y axis of rotate camera.



You should look into finite state machines if you're going to chain more sequences like that.

MateiSoft Romania
12
Years of Service
User Offline
Joined: 16th Oct 2013
Location:
Posted: 21st Jun 2014 11:41
Maybe i will use curveangle, the code provided is not really working but thank you very much again!

Alex Matei CEO
www.alexmatei.com
MateiSoft Romania
12
Years of Service
User Offline
Joined: 16th Oct 2013
Location:
Posted: 21st Jun 2014 12:03
Not even with curveangle, the idea is to rotate the camera when a value reaches a value

Alex Matei CEO
www.alexmatei.com
MateiSoft Romania
12
Years of Service
User Offline
Joined: 16th Oct 2013
Location:
Posted: 21st Jun 2014 12:59
I found a solution but i cannot seem to change the angle value, if i set to 90, it will go something around 25 or 15 all the times.



Alex Matei CEO
www.alexmatei.com
Chris Tate
DBPro Master
17
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 21st Jun 2014 18:18
b# = curveangle(camera angle y(0),b#,5)

Just wanting to know, why would the camera angle be the destination angle? Is that correct that you want b# to gradually interpolate towards the camera angle?

MateiSoft Romania
12
Years of Service
User Offline
Joined: 16th Oct 2013
Location:
Posted: 21st Jun 2014 23:09
Yes i want to rotate the camera to some degrees like 20 or 90 with b#

Alex Matei CEO
www.alexmatei.com

Login to post a reply

Server time is: 2026-07-06 00:08:54
Your offset time is: 2026-07-06 00:08:54