How to change speed (integer) by 0.2
nir3112
Member, PRO Posts: 312
I have a attribute (speed) and I want to change it every 5 by 0.2
I did everything right but its not changing anything...because its integer
So how can I change my speed by 0.2???
Plz help!
I did everything right but its not changing anything...because its integer
So how can I change my speed by 0.2???
Plz help!
Comments
It's probably something to do with how you have your code set up.
Real can contain 1.2 1.3 1.4 100.33 1000.33 etc.
http://www.mathsisfun.com/whole-numbers.html
Lump Apps and My Assets
when speed>0.3
timer: every 5 sec
change attribute speed to speed-0.02
this not working at all in integer (because its integer) and in real its working but the speed doesn't changing when the game is running i need to restart the game
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
I see in different posts you have one(question) or the other(code).
To each their own. If you can only get it working with integers, just multiply by 5 or 50, then where you use the speed, divide by 5 or 50.
'Integer' not working..
'Real' change value but it not effect on the actor, if I want it to effect on it I need to restart the game..
So how can I change attribute by real number without restart the game?
@nir3112
I was asking for information about "speed". Is it an independent variable or is it a dependent variable. Where does speed get its value from, and does the value of speed change other variables, or do the values of other variables change the value of "speed"?
Is it a game attribute, scene attribute, actor attribute, or a value in a table or array?
You say it won't change during game, do you have an actor set up that will display "speed" in number form while playing? Or are you watching for a change in movement of an actor?
Grim
I was asking for information about "speed". Is it an independent variable or is it a dependent variable. Where does speed get its value from, and does the value of speed change other variables, or do the values of other variables change the value of "speed"?
Is it a game attribute, scene attribute, actor attribute, or a value in a table or array?
You say it won't change during game, do you have an actor set up that will display "speed" in number form while playing? Or are you watching for a change in movement of an actor?
Grim
1. i created actor that change the value of "speed" every 5 sec and i put it on the screen.
2.it's game attribute.
i created actor that display the speed and the value is changing but the speed of the moving actor dosn't changed
How does this attribute ("speed") control the 'moving actor' ?
Ok! That is exactly what we needed to know!
Now, delete that attribute "speed", it is just getting in your way lol.
Changing "Speed" is like changing the time on your clock, if you set the clock ahead 6 hours it won't make it dark outside because the clock doesn't CONTROL time, it just reports the time
What you are wanting to modify (and dusplay) are the Actor attributes "self.linear.velocity.x" and "self.linear.velocity.y" of the actor whose speed you want to change
Grim