Actor move up and down loop without any rules
greenturtle
Member Posts: 22
Hi Guys,
1) How do I make an actor move up & down automatically without any rules? other than e below method.
I tried to search within gamesalad forum, the closest I can find is this:
https://forums.gamesalad.com/discussion/32702/moving-up-and-down-objects
I tried to follow the same by having
(timer - every 4 seconds ) if i set to after or for, it will work, but I need it to keep looping, so i have to use every, but it didn't work
(timer for 2 seconds ( move right )
(timer after 2 seconds ( move left )
2) But it didn't work, what have I done wrong?
what i want it's forever move up for a while then move down again for awhile again no matter what happen.
Thanks in advance!
1) How do I make an actor move up & down automatically without any rules? other than e below method.
I tried to search within gamesalad forum, the closest I can find is this:
https://forums.gamesalad.com/discussion/32702/moving-up-and-down-objects
I tried to follow the same by having
(timer - every 4 seconds ) if i set to after or for, it will work, but I need it to keep looping, so i have to use every, but it didn't work
(timer for 2 seconds ( move right )
(timer after 2 seconds ( move left )
2) But it didn't work, what have I done wrong?
what i want it's forever move up for a while then move down again for awhile again no matter what happen.
Thanks in advance!
Comments
You could hard code the values but this will make the actor go between
self.MiddleValue-self.DistanceFromMiddle
and
self.MiddleValue+self.DistanceFromMiddle
And you can change the 200 higher or lower depending on how fast you want the actor to move.
if lets say the actor's Y position is 150, the size of it 50x50. where is the self middle value and self distancefromMiddle?
I tried to add the constraint attribute, it didn't work out. does gamesalad recognise self.MiddleValue?
...Don't really need the absolute value in there, but...
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
& info on the forumla you gave me?
I know it has to do with maths calculation but I want to understand the logic behind it!
So I can tweak to the way I want
Thank you so much~
1) could you explain what is distance from value? and why the position of Y - screen size/3?
2 )also the *sin( self.Time *200) too if possible
3) last question, why if I put the object higher (y position value), the smaller the movement?
Thanks in advance again
You can find about all of the GameSalad functions here - http://cookbook.gamesalad.com/definitions#function
The absolute value will change any negative number to positive. Which in this case, doesn't really matter. I just threw it in there.
"sin" is the trigonometric sine function. For more information about that function, and example for what it can be used for, I'd recommend checking out: http://en.wikipedia.org/wiki/Trigonometric_functions.
If you want the actor to move faster, just change the self.Time*XYZ to anything you need. The higher the number, the faster it will move when previewed.
If you move the actor around the screen, the value between the actor and the center of the screen is changed (which is determined in the first change attribute). So you might only have the actor move a little bit depending on where it is, or it could move a long distance depending on where it is.
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
http://gshelper.com/shop/free-templates-and-tutorials/orbzample-trig-101/
Thanks for the info, i will look up & read tonight.
Meanwhile, in short,
Is Distance from Middle is
the value between the actor and the center of the screen is changed (which is determined in the first change attribute? Did I understand it correctly?
@ORBZ,
could you explain what is self.MiddleValue? I really want to know and learn.
Since i know what is distance from middle is.
And thanks for the template.
I looked it and tried to understand but there's a couple of things i don't understand.
1st) is the Distance from Middle the value between the actor and the center of the screen is changed (which is determined in the first change attribute? Did I understand it correctly?
Edited: I think i understand wrongly, Distance from middle is saying the values of the object's position Y from the screen centre thats all.
2nd) why the getting the 1st value is (position Y - screen Y size) /3?
This is maths part I don't understand, as in if position y - screen y size, the difference is the amount position y to the end of screen y.
why divide by 3 will get us the values position y from centre of the screen? (assuming distance from middle is the above meaning)
3rd) lets say I want to actor to move same amount of up & down no matter what in what position, what should I change? I noticed I move the object higher ( higher positiion Y) the less the movement is, lower the position y, the greater the movement is.
Edited: I added constrain self position y to 284+40*sin( self.Time *200)
it move same amount of values no matter what! Meanwhile, i will read up the sin and try to understand.
I know it's because when it's higher, the forumla is become smaller. so it keep moving down then to the point it, values (forumla of *sin part become higher, then it keep moving up.)
Thanks @Braydon_SFX! I hope I didn't ask too many questions.
Thanks, from what I read and ask around it's like every 360 degree in this case it's time, it will reset by itself hence results in moving up & down. Is there anything I miss?
Now I only left to understand what is Distance from Middle, self. Middle value & how they calculate. Do you know?
Thanks again!