Constraining attributes for a following actor

skippyskippy Member Posts: 106
edited November -1 in Working with GS (Mac)
If there is a fish tank on the screen and a fish inside the tank and the constraining attributes keep the fish in the tank, when the tank gets destroyed why does the fish stays where the tank was destroyed where as i want the fish to fall down, iv'e tried different combinations like move, change velocity, accelerate but everything i try the fish remains where the tank was destroyed, are the constraining attributes keeping the fish there ? can i disable them when the fish tank is destroyed to make the fish fall downwards ?
I did this for the following actor "the fish" when the main actor is destroyed :
create rule, attribute game.lifebar = 0
destroy this actor (which works)
but nothing else will to make the fish fall instead of destroy

Comments

  • firemaplegamesfiremaplegames Member Posts: 3,211
    Create a global boolean attribute called something like FishTankIsDestroyed

    Wrap your Constrain Attributes for the fish in a Rule, like this:

    Rule
    When game. FishTankIsDestroyed = FALSE
    Constrain Attributes
    Otherwise
    Accelerate Direction:270, Speed: whatever

    When the tank gets destroyed, set game. FishTankIsDestroyed to TRUE
  • JGary321JGary321 Member Posts: 1,246
    How about something similar:

    game.boolean - Fish Tank Destroyed

    In your fish actor:

    When Fish Tank Destroyed = False
    Constrain blah blah

    else: acceleration spd 1200 (play with it) direction 270

    In your Tank actor:
    Wherever you have your destroy rule also put a rule to change game.Fish Tank Destroyed = True

    Hope this helps

    JGary

    EDIT: FMG - GRRRRRRRRRRRR
  • firemaplegamesfiremaplegames Member Posts: 3,211
    great minds and all...
  • skippyskippy Member Posts: 106
    Thats awesome guys thanks for the quick response it works well, it gets exciting as you make progress cheers
  • ORBZORBZ Member Posts: 1,304
    i saw it from a physics point of view:

    why not just create the fishtank as a set of two invisible walls, a floor and a ceiling the fish will bounce back and forth inside the container. when the fishtank is destroyed, the invisible walls will vanish, and the fish will fall to the floor. no code needed.
  • skippyskippy Member Posts: 106
    Thanks Orbs the fish tank will be moving as well though so id have to put constraining attributes on the invisible walls anyway to follow the other actor, i'm no expert but i think thats right.
  • design219design219 Member Posts: 2,273
    You could also try just destroying the fish too and spawning a new one.
Sign In or Register to comment.