howto move an actor back and forth ?!

r0x0rr0x0r Member Posts: 9
edited November -1 in Working with GS (Mac)
title. Basically what I want to do is to move a sprite every X seconds -32px on Y-axis and once there, wait Y milliseconds and return to its origin. Thanks!

Comments

  • DrGlickertDrGlickert Member Posts: 1,135
    You could use timers and the interpolate functions:

    Timer: Every X seconds Interpolate self.position.y to self.position.y-32.

    After X seconds, Interpolate self.position.y to self.position.y+32

    Is that what you're looking for?
  • r0x0rr0x0r Member Posts: 9
    Almost, I need a smooth movement :) not 0 to 32 directly but 1,2...32. (in like 200ms)

    Well maybe I should expose the goal better, I'm trying to achieve a movement that would be similar to an animal that takes his head out of his hole (aka home :P) and then goes back in (all happens relatively fast). I tried many things with 'move to', 'move', 'rule', 'timer', I don't know what to do honestly I can't manage to do that easy task..
  • r0x0rr0x0r Member Posts: 9
    guess what, I checked the examples from the app itself, I watched video tutorials, I used the 'search' button in the forum, and I checked the wiki ... Nah really you won't guess it, let me tell ya, I didn't find anything! Lots of useful information on that wiki like the item 'Display Text' actually what it does is to "display text", luckily there's a wiki for that.
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    r0x0r said:
    guess what, I checked the examples from the app itself, I watched video tutorials, I used the 'search' button in the forum, and I checked the wiki ... Nah really you won't guess it, let me tell ya, I didn't find anything! Lots of useful information on that wiki like the item 'Display Text' actually what it does is to "display text", luckily there's a wiki for that.

    I dont really think getting an attitude is gonna be the best way to get others to help you. You have been here all of 6 hours I highly doubt you have watch every tutorial and read the entire wiki. movements are some of the easiest behaviors to set up so maybe an apology to jon is in order and back track and start reading the forum is here to help you not tell you how to build every aspect of your game.
  • r0x0rr0x0r Member Posts: 9
    A RFTM answer doesn't help much. There is nothing about how to stop a move in the documentation other than when it is your actor (that you are moving based on a I/O event).

    I think the problem is the documentation that doesn't explain the objects we can use for "programming". I am a C developer and I tried many logic things. Let me show you one.

    - create Animal (actor) with two attributes, originY and destY as real.
    - add Timer after 1sec (for testing going UP).
    - in Timer: add Change Attribute self.originY to self.Position.Y
    - in Timer: add Change Attribute self.destY to self.Position.Y-32
    - in Timer: add Rule when all conditions are valid.
    - in Rule: add Attribute self.Position.Y >= self.destY
    - in Rule: Move

    Fail. The actor never stops, why ? Self.Position.Y not updated every frame ? How to Debug (other than adding Display Text objects) ?

    Next time, the minimum that someone can do who wants to help is to directly point to the information instead of saying "RTFM" (totally useless and insulting).
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Again you just started here. RTFM and search the forum. you will learn timers suck and interpolate is great. some times you can replace timers with interpolate and some times you cant but movements based on conditions are simple with GameSalad but you need to RTFM and play with it to get the hang of it.
    You will have to forgive us we have been dealing with many for the last 4 months who come here and expect the forum users to tell them how to make their games because there is no code and its still not easy enough for them. So please do not disrespect the users of this forum with your attitude that we should cater to your every need. we are here giving help for free so don't abuse it by expect us to lay your rules out for you on easy tasks.
  • sparkzillasparkzilla Member Posts: 152
    I had this problem. I used the timer tutorial. It worked.

    http://gamesalad.com/wiki/how_tos:gsc_pacing
  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    r0x0r said:
    guess what, I checked the examples from the app itself, I watched video tutorials, I used the 'search' button in the forum, and I checked the wiki ... Nah really you won't guess it, let me tell ya, I didn't find anything! Lots of useful information on that wiki like the item 'Display Text' actually what it does is to "display text", luckily there's a wiki for that.

    then you didn't try very hard at all.

    Gamesalad Wiki -> How To -> Movements -> How to make an actor pace back and forth

    http://gamesalad.com/wiki/how_tos:gsc_pacing (same link sparkzilla posted)
  • r0x0rr0x0r Member Posts: 9
    jonmulcahy said:
    then you didn't try very hard at all.

    Gamesalad Wiki -> How To -> Movements -> How to make an actor pace back and forth

    http://gamesalad.com/wiki/how_tos:gsc_pacing (same link sparkzilla posted)

    I already read that and it doesn't help because the movement has no Y destination, it moves 'til an unknown Y position (based only on time, that's another problem with that game engine, always based on collision or time or event, not on X/Y positions) ...
  • r0x0rr0x0r Member Posts: 9
    tenrdrmer said:
    Again you just started here. RTFM and search the forum. you will learn timers suck and interpolate is great. some times you can replace timers with interpolate and some times you cant but movements based on conditions are simple with GameSalad but you need to RTFM and play with it to get the hang of it.
    You will have to forgive us we have been dealing with many for the last 4 months who come here and expect the forum users to tell them how to make their games because there is no code and its still not easy enough for them. So please do not disrespect the users of this forum with your attitude that we should cater to your every need. we are here giving help for free so don't abuse it by expect us to lay your rules out for you on easy tasks.

    I'm sorry but it seems you didn't try what I explained, try it, then come back and talk. It uses attributes, movements, conditions, timers, but the behavior is not what it is expected to be. Mabye you want a pseudocode picture of what my example does:

    /* That's the Timer behavior */
    time_begin = getLocalTime();
    do {
    time_end = getLocalTime();
    } while(time_end < time_begin+1000); // as it if was in ms, wait 1sec

    /* Change Attribute behavior */
    originY = actor.position.Y;
    destinationY = actor.position.Y - 32; // go up 32px

    /* Rule */
    while (actor.position.Y > destinationY) {
    actor.move(DIRECTION_UP, DESIRED_SPEED);
    }

    sparkzilla, thanks for the advise but it stills the same problem, you stop movement based on time, I need to stop movement at a desired Ypx (origin Y - 32 in that case)
  • StusAppsStusApps Member, PRO Posts: 1,352
    the game engine has plenty of options for events based on x and y positions, same as collision or time event.

    you could probably achieve what you want using interpolate if it is only one actor.

    rule:

    when self.position.y = 80 (wherever you want it really)
    timer: after 5 seconds
    interpolate self.position.y to 68
    linear movement over 2 seconds (up to you again)

    then another rule:

    when sefl.position.y=68
    timer: after 5 seconds
    interpolate self-position.y to 80
    linear movement over 2 seconds again

    This will keep moving back and forward between the positions and rest for 5 seconds at each point.
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    StusApps said:
    the game engine has plenty of options for events based on x and y positions, same as collision or time event.

    you could probably achieve what you want using interpolate if it is only one actor.

    rule:

    when self.position.y = 80 (wherever you want it really)
    timer: after 5 seconds
    interpolate self.position.y to 68
    linear movement over 2 seconds (up to you again)

    then another rule:

    when sefl.position.y=68
    timer: after 5 seconds
    interpolate self-position.y to 80
    linear movement over 2 seconds again

    This will keep moving back and forward between the positions and rest for 5 seconds at each point.

    they must not use that type of simplicity in obj C

    thats what I was thinking to0. just not really willing to help someone who's not willing to help themselves.
  • StusAppsStusApps Member, PRO Posts: 1,352
    I agree with you, seems to be an outpouring of new people questions today clogging up the forum. Peoples unwillingness to read or do trial and error does kinda irk me.
  • r0x0rr0x0r Member Posts: 9
    StusApps said:
    I agree with you, seems to be an outpouring of new people questions today clogging up the forum. Peoples unwillingness to read or do trial and error does kinda irk me.

    Are you serious ? I spent 6h doing trial and error, I browsed the examples, the wiki, the videos, the tutorials (howtos). And I still don't manage to stop a movement without using a collision/key_press/etc, simply based on the destination Y. I tried many logical ways and it doesn't work.

    StutsApps: can you provide an example that works, because all the ways I used were supposed to work, so I bet yours won't work too.

    Also, after X hours of trial and fail gamesalad becomes extremly slow, I guess there are tons of memory leaks, it becomes unusable.
  • r0x0rr0x0r Member Posts: 9
    tenrdrmer said:
    they must not use that type of simplicity in obj C

    thats what I was thinking to0. just not really willing to help someone who's not willing to help themselves.

    Nobody is able to provide a working example, because it's a bug in the game engine. Oh wait, you would have seen it if you weren't going like "GODMODE RTFM attitude".
  • r0x0rr0x0r Member Posts: 9
    I'm done with that !@#$%, nothing works, still in beta and horribly coded. I'm going to use a real game engine: cocos2d, enjoy your gamesalad experience.
  • b2iscoolb2iscool Member Posts: 135
    Ok r0x0r boxor a similar question to this is literally asked atleast 2 times a day and answered by tenrdrmer me tshirt ace mulcahy or one of the many ppl in this forum. So you can cool your jets then wait 10 seconds and check the forums k?
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    http://www.mediafire.com/?d4z901bb76x0sh3

    heres a demo smart one. Change the number in the timer to change the time it takes to move back up after going down, and change the duration in each of the interpolate rules to control how fast or slow it moves up and down.

    have fun
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    r0x0r said:
    Nobody is able to provide a working example, because it's a bug in the game engine. Oh wait, you would have seen it if you weren't going like "GODMODE RTFM attitude".

    Thats some bug. I must have snuck past it cause I got stuff to go up and down and side to side all at the same time even.



    Thanks For Sale if you'd like to see how I did it. Of course I would have just told most people who asked in a civil non rude sort of way.

    ___________________________________________________________________________________
    GS BubbleBall Template HERE!!
    Stacks Level Selection Template HERE!!
    AppSolute Entertainment on Facebook
Sign In or Register to comment.