How to check the duration in seconds of my actor colliding with a ground actor?

FirstDanFirstDan Member Posts: 208
edited January 2012 in Working with GS (Mac)
Hi all

When an actor jumps on a ground actor,
if the actor is on that ground actor for 3 seconds, i want to change the image of that background actor.

currently what i have is, when actor collides with ground,
timer- after 3 seconds
change attribute self.image to mychangedimage.png

but what happens is, if i touch the ground, it carries on after 3 seconds and changes the image..

How would i achieve this?

also why doesnt the following work

change attribute self.visible to false
but this doesnt work?

thanks

Comments

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited January 2012
    Hi @FirstDan, your first question about why it changes the image after 3 seconds.... because you asked it to. (Timer after 3 seconds). So I don't quite understand what you're after to achieve.

    As for changing self.visible, you can't; this is one of those attributes that you choose its state before gameplay (like Moveable) which can't be changed with an attribute. Use change attribute self.Color.Alpha to 0 as a suggestion.

    ----------------------------------------------
    http://davidgriffinapps.co.uk/

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • FirstDanFirstDan Member Posts: 208
    @gyroscope - thanks for your reply, here is what im trying to achieve, if my actor has stayed on a ground actor for 3 seonds, i want to change that image, but the actor must stay on the ground actor for 3 seconds for the image to change, hope that explains it better

    thanks
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Hi, do you mean 3 seconds exactly? The following should work:

    When YourActor overlaps or collides with YourGroundActor
    Timer After 3 seconds
    Change Image

    ...but I get the idea you've tried that and it's not working?

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • CloudsClouds Member Posts: 1,599
    edited January 2012
    Change 'after' to 'every'.

    Link: http://www.mediafire.com/?3jaqzc8nmey4xyx

    (use the up and down arrows to move the actor up and down - when he stays on the floor for 3 or more seconds he turns red)
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    make sure run to completion isnt checked. what gyro posted will work.

    If you have run to completion checked, even if your not touching the ground for the full 3 seconds, 3 seconds after the first touch it will change, so make sure its not checked
  • CloudsClouds Member Posts: 1,599
    edited January 2012
    @JohnPapiomitis

    Whoops! Yep, that's a much better way of doing it (and much less stupid than my way \m/ ) ignore my post !!

    Leave your timer as an 'after' timer and make sure run to completion is unchecked.
Sign In or Register to comment.