sin: up or down

hi guys,
how can i check if the attribute is moving up or down (using a sinus on an attribute..)??
i can create a Boolean up thats true or false but how can i check if the attribute is going up (or not)....
wouter
how can i check if the attribute is moving up or down (using a sinus on an attribute..)??
i can create a Boolean up thats true or false but how can i check if the attribute is going up (or not)....
wouter
Comments
________________________________
【ツ】iPhone Icon Pack 【ツ】 - 【ツ】Graphic Pack【ツ】
Free GS demo: High score simple and advanced; Game Center; App Rating System
Make a rule that when your attribute > self.test:
change attribute self.up/down to 1 & change attribute self.test to your attribute
OTHERWISE
when attribute your attribute < self.test:
change attribute self.up/down to 2 & change attribute self.test to your attribute
This means that when self.up/down is 1 your attribute will be increasing and when it is 2 your attribute will be decreasing.
Haven't tested this and the effectiveness may vary depending on how fast your attribute is changing.
@RH
and this can't with you're way;) if this also can't with the linear speed, witch way is the best?
if motion linear x is < 0 your moving right
if motion linear y is > 0 your moving up
if motion linear y is < 0 your moving down
only another problem (maybe) is that the attribute stays on 1/3 of the screen... so you see only the background moving and the attribute moving up and down... don't know if this is a problem?
thanks!
If you name your images image1, image2, image3, etc. image1 for <20, image2 for <40 and so on.
You can then add a constrain attribute:
self.image -- to -- "image"..ceil(self.positionY/20)..".png"
tried couple of things:
made a game attribute velocity x and velocity y
constrain attribute: game.velocity y to self.motion.lineair velocity. Y and tried to display it (display text game.velocity y), but there happened nothing (only displayed 0...)
then i tried to make a game attribute up, and a rule:
when attribute self.motion.therest > 0 change attribute game.up to true, otherwise game.up to false,
only he displayed false the whole time...
what do i wrong??
thanks;)
oh and RH i see what you mean (and thanks;), only i don't know how to do that with the y location... (think thats also the fault here...)
think this will work, only i need to animate the actor.... or must i use also the x location to calculate the direction?
thanks;)
looks like the example: http://gamesalad.com/wiki/how_tos:gsc_wave_movement
so i have:
constrain attribute: game.position y to game.amplitude*cos(game.period*(self.position.X-self.InitX))+game.balance (y position where the cos or sin is moving around;)
or can't this be done in gamesalad?...
(edit:)
hey i have an idea!!!!
if i let an other actor move with the sin actor, will the position y work on that actor?:D
[edit2]
mmm the y position works now! i think (not sure) that its now working because i have placed it on the top (for all the rules)...
so how can i calculate the direction?
x1,x2,y1,y2 and then y2-y1/x2-x1 ???
and thank you RH!!!! i was stuck on this point (is this correct english? lol)
When attribute game.up/down = game.balance + game.amplitude
change attribute game.up/down to 2
OTHERWISE
When attribute game.up/down = game.balance - game.amplitude
change attribute game.up/down to 1
This means that when game.up/down = 2 game.positionY is increasing and when it = 1 it's decreasing.
That works in my project I just tested it in so hopefully you can get it to work in yours.
i let you know if it works;)
i tried something different (with y1 and y2):
constrain attribute game.y1 to self position.Y
rule: game.Y2>game.Y1{
game.up to 0
game.Y2 to game.Y1
}
otherwise{
game.up to 1
game.y2 to game.y1
}
only above the balance he says 1 and under false??!! lol do you know what my fault is? (now i am going to use you're way;)
did exactly what you said.
but it's logic because game.up = 0 in the beginning so:
0 = game.balance (260)+game.amplitude(30)
no its not... so otherwise:
0=260-30 no its not!!
so you mean something else what you said, or i don't get it;)
i send you an email;)
wouter