Move Actor x amount of pixels every passing second of game.time?

Simple Gamer ArtsSimple Gamer Arts Member, PRO Posts: 305
edited December 2017 in Working with GS (Mac)

How can I move my actor every "rounded" second on my game clock?

I have:
TIMER / EVERY / round( game.Time )+1

it works for a while until I do another action that kills the formula.

Ok, so I have multiples of the same actor that all should move synchronized to the game clock... how you go about that?

Comments

  • SocksSocks London, UK.Member Posts: 12,822
    edited December 2017

    @Simple Gamer Arts said:
    TIMER / EVERY / round( game.Time )+1

    A timer using 'every' cannot have a varying value ("game.Time"), the word 'every' means all the members of a set, so it doesn't really make sense to say 'every' and then follow with a varying value !

    You know, like saying every cat has whiskers, or every dog has a nose, they work, but saying every mouse has - and then insert a changing set of things . . . it kind of negates the word 'every'

    Mmmm . . . that's not a great analogy . . . it's more like saying every cat has whiskers, or every dog has a nose (both work), then saying every (changing item) has a tail, it simply doesn't make sense, because 'every' is sort of shorthand for 'all'.

    Hope that makes sense !

    And even if it did work (it doesn't) then the space between timing events would simply be growing larger and larger every second as game.Time increases.

  • Simple Gamer ArtsSimple Gamer Arts Member, PRO Posts: 305

    @Socks That is one of the best gifs I've seen

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

    @Simple Gamer Arts said:
    @Socks That is one of the best gifs I've seen

    You've obvioulsy not seen the stunning pizza Christmas tree . . . .

  • Simple Gamer ArtsSimple Gamer Arts Member, PRO Posts: 305

    @Socks That is wonderful lol

  • Simple Gamer ArtsSimple Gamer Arts Member, PRO Posts: 305
    edited December 2017

    Ok, all jokes aside lol @Socks

    I have RULE:

    when ATTRIBUTE: ROUNDEDGAMECLOCK = ROUNDEDGAMECLOCK+1
    Actor moves X pixels to the left...

    it's not working...

  • Simple Gamer ArtsSimple Gamer Arts Member, PRO Posts: 305
    edited December 2017

    I can't stop watching that first gif...

  • SocksSocks London, UK.Member Posts: 12,822
    edited December 2017

    @Simple Gamer Arts said:
    when ATTRIBUTE: ROUNDEDGAMECLOCK = ROUNDEDGAMECLOCK+1
    Actor moves X pixels to the left...

    it's not working...

    Yes, ROUNDEDGAMECLOCK will never equal ROUNDEDGAMECLOCK+1 it will always equal ROUNDEDGAMECLOCK.

    You are asking GameSalad to check whether something (ROUNDEDGAMECLOCK) is the same as something different (ROUNDEDGAMECLOCK+1).

    Remember, ROUNDEDGAMECLOCK is a number, so you are effectively saying . . .

    When 3 = 3+1 then . . .

    . . . 3 will never equal 4, so this rule would never fire.

  • Simple Gamer ArtsSimple Gamer Arts Member, PRO Posts: 305
    edited December 2017

    I see what you are doing @Socks lol

    It's good it's good, one learns best this way.

  • SocksSocks London, UK.Member Posts: 12,822
    edited December 2017

    @Simple Gamer Arts said:
    I see what you are doing @Socks lol

    It's good it's good, one learns best this way.

    What are you trying to do ? Are you trying to move an actor once every second ?

    And what is a 'rounded second' ? How does it differ from a normal second ?

  • Simple Gamer ArtsSimple Gamer Arts Member, PRO Posts: 305
    edited December 2017

    @Socks There are 10 of the same exact actors on screen, but are spawned upon screen at different times. My objective is to make them all move at the same time to the left X amount of pixels EVERY second.

    The reason I used the GAME CLOCK is because it's a way of channeling the same interval of time to all actors. It doesn't matter the different type of seconds, as long as it's the same for all actors so they could move at the same time... like in Snake, all of the snake's blocks move at the same time I imagine to some game clock.

  • SocksSocks London, UK.Member Posts: 12,822
    edited December 2017

    @Simple Gamer Arts said:
    There are 10 of the same exact actors on screen, but are spawned upon screen at different times. My objective is to make them all move at the same time to the left X amount of pixels EVERY second.

    Make 'Game' attribute, call it 'MOVE' (or whatever you like), then make a new actor to control the movement of all the other actors, let's call this new actor 'Move Controller'.

    Rules for Move Controller

    Every 1 second
    --Change MOVE to 1
    --After 0.5 seconds
    ----Change MOVE to 0

    Rules for your other actors

    When MOVE = 1
    --Move the actor a bunch of pixels to the left using whatever method you like.

    (Place the Move Controller at the bottom of all the layers, under the actors / spawner).

  • Simple Gamer ArtsSimple Gamer Arts Member, PRO Posts: 305
    edited December 2017

    Thanks so much @Socks

    Ok, I did it but the integer is not changing back 0... it changes to 1, and all actors move to left... but then it stays... doesn't go back to 0.

  • SocksSocks London, UK.Member Posts: 12,822
    edited December 2017

    @Simple Gamer Arts said:
    Thanks so much @Socks

    Ok, I did it but the integer is not changing back 0... it changes to 1, and all actors move to left... but then it stays... doesn't go back to 0.

    Yes, the way you have it set up means that the first timer will fire EVERY 1 second, and the second timer will fire ONCE, after half a second, which is not what you want.

    The indented convention used when typing out rules like this . . .

    Rule
    --A
    --B
    ----C

    . . . means that there is a rule, and WITHIN that rule there are two elements A and B, and nested WITHIN B is another element called C.

    So . . . if you look at my original suggestion . . .

    Every 1 second
    --Change MOVE to 1
    --After 0.5 seconds
    ----Change MOVE to 0

    . . . you need to place the second timer WITHIN the first timer, so the second timer fires repeatedly (once every second).

    At the moment you have this . . .

    Every 1 second
    --Change MOVE to 1

    After 0.5 seconds
    ----Change MOVE to 0

  • Simple Gamer ArtsSimple Gamer Arts Member, PRO Posts: 305

    Fixed it!

    Every 1 second
    --Change MOVE to 1
    --EVERY 0.5 seconds
    ----Change MOVE to 0

    So I changed the second part to EVERY instead of AFTER.... you are the man @Socks thanks!!!!

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

    @Simple Gamer Arts said:
    Fixed it!

    Every 1 second
    --Change MOVE to 1
    --EVERY 0.5 seconds
    ----Change MOVE to 0

    So I changed the second part to EVERY instead of AFTER.... you are the man @Socks thanks!!!!

    The second part needs to be 'AFTER', otherwise - as your project grows - you'll find you have timing issues.

  • Simple Gamer ArtsSimple Gamer Arts Member, PRO Posts: 305
    edited December 2017

    @Socks I'll see what I can do about that AFTER... it's not working if I put AFTER...

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

    @Simple Gamer Arts said:
    @Socks I'll see what I can do about that AFTER... it's not working if I put AFTER...

    Can you post a screenshot of the offending code ?

  • Simple Gamer ArtsSimple Gamer Arts Member, PRO Posts: 305

    @Socks It's the same screenshot a couple of messages up.

  • SocksSocks London, UK.Member Posts: 12,822
    edited December 2017

    @Simple Gamer Arts said:
    @Socks It's the same screenshot a couple of messages up.

    Did you read my post above ? The one that starts . . "Yes, the way you have it set up . . . " ?

    You need to place the second timer into the first.

  • Simple Gamer ArtsSimple Gamer Arts Member, PRO Posts: 305

    @Socks AHHHH I completely missed that message above at 6:35pm... sorry! It works like a charm thanks!

    There are several other issues I'm running into to make this game happen. I have the game clear in my head; I think it's doable in like 2 hours. Could I do a paid one on one SKYPE session with you so you can guide me through these cracks I'm running into? If that is not your thing, it's cool, I'll understand.

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

    @Simple Gamer Arts said:
    There are several other issues I'm running into to make this game happen. I have the game clear in my head; I think it's doable in like 2 hours. Could I do a paid one on one SKYPE session with you so you can guide me through these cracks I'm running into? If that is not your thing, it's cool, I'll understand.

    No way ! :)

    I am a member of a strict orthodox no-Skype religion, we have turned our backs on the wickedness of VOIP.

  • Simple Gamer ArtsSimple Gamer Arts Member, PRO Posts: 305
    edited December 2017

    @Socks Alright so you're an extremist, that's cool lol... or maybe I am... depends how you look at it. Thanks for the help man :)

Sign In or Register to comment.