Stopping actor from leaving the camera

ForteForte Member, PRO Posts: 297
edited November -1 in Working with GS (Mac)
Hello everyone,

trying to make a shoot-em up game, but I don't want the main actor to leave the camera. I have tried barriers that follow at the back end of the camera, but when the actor hits it, the barrier moves. Then the actor can get out of the screen. Large problem, I went into the physics attributes and unticked the box for "moveable" then the barrier did not move at all!

Please if someone who has come up with a solution, that would be great!

Cheers, Dragokillz

Comments

  • ktfrightktfright Member Posts: 964
    are your walls set to not moveable? i recently made a shoot em up, so i can help a bit. also, is your shooter actor set to be able to collide with the wall?
  • ForteForte Member, PRO Posts: 297
    yes it does collide with the wall, but when to collides the wall moves back. i have the wall moving as a behavior to keep up with the camera, but then the actor pushes it away
    btw fixed rotation is on
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    If you are using the Shoot em Up template, there is an actor that controls the position of the camera. With that you have a reference position you can work with. i.e. the position of that actor.

    Using that, constrain that position to some game attributes(real type).

    In your ship actor add a condition on your movement rules that check that the ship isn't too far from that game attribute tracking the position of the camera.

    Also make a rule that checks if the position of your ship is less than the position of the camera minus some offset. And constrain the position of the ship if that is true.

    I've just added a modified Shmup so you can see this in action.
    Check out http://gamesalad.com/game/play/26504
    Or find it in the shared projects under 'ShootEmUp Move Fix(Demo)'
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    If you are using the Shoot em Up template, there is an actor that controls the position of the camera. With that you have a reference position you can work with. i.e. the position of that actor.

    Using that, constrain that position to some game attributes(real type).

    In your ship actor add a condition on your movement rules that check that the ship isn't too far from that game attribute tracking the position of the camera.

    Also make a rule that checks if the position of your ship is less than the position of the camera minus some offset. And constrain the position of the ship if that is true.

    I've just added a modified Shmup so you can see this in action.
    Check out http://gamesalad.com/game/play/26504
    Or find it in the shared projects under 'ShootEmUp Move Fix(Demo)'
Sign In or Register to comment.