make actor goes up and down

kiwacikiwaci Member, PRO Posts: 72

hello,
i've made an endless game where an actor spawns twice at the same x position but different y position, what i want is to make him goes up and down in a slow speed while he remain the same x position . i've found this formula "Constrain Attribute : self.Position.Y to 25sin(self.Time300)+208" but the problem is that it doesn't work when the actor is spawning, because the position is changing. I don't know if you understand me , but if you do, can you please help.

Thank You.

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    The 208 in that expression is the offset. Try replacing that with self.startY and then adding a change attribute behavior to change self.startY to self.position.Y.

  • SocksSocks London, UK.Member Posts: 12,822
    edited March 2014

    What @tatiang said . . . .

    . . . .also: 25sin(self.Time300)+208 should read 25 * sin(self.Time * 300)+208

  • SocksSocks London, UK.Member Posts: 12,822

    @tatiang‌

    Problem with the new text formatting . . . . . .

    Placing an asterix in code (as in >> self dot time asterix three hundred) results in the asterix being wrongly removed (presumably as it's seen as an unclosed formatting tag ?).

    Not great for communicating GameSalad code !

  • kiwacikiwaci Member, PRO Posts: 72

    @tatiang said:
    The 208 in that expression is the offset. Try replacing that with self.startY and then adding a change attribute behavior to change self.startY to self.position.Y.

    Works perfectly , thank you :smiley:

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited March 2014

    @Socks

    @Socks said:
    tatiang‌

    Problem with the new text formatting . . . . . .

    Placing an asterix in code (as in >> self dot time asterix three hundred) results in the asterix being wrongly removed (presumably as it's seen as an unclosed formatting tag ?).

    Not great for communicating GameSalad code !

    There are a bunch of changes to the forum text editor. For example, typing in a username after '@' no longer notifies that person unless you select their name from a drop-down menu of auto-complete choices. And as I'm sure you noticed, quotes no longer use the 'blockquote' tag but instead just a single greater than sign. Option/alt+space doesn't work for indenting text, which was my all-time favorite trick.

    Time for me to make a quick primer for everyone!

  • SocksSocks London, UK.Member Posts: 12,822

    @tatiang said:
    Socks

    Time for me to make a quick primer for everyone!

    I think the new formatting is great - even though I don't know my way around it yet - but it seems much more simple.

Sign In or Register to comment.