Simple way to know if on screen?

fmarkusfmarkus Member Posts: 42
edited November -1 in Working with GS (Mac)
Hello!
I'm trying to find a way to detect if an incoming enemy is on screen or not. My game is a side scroller, my enemies come from the right outside the screen. I tried to set up a zone covering part of the screen with an object and do a collision/overlap event but it doesn't work with the zone been on a non movable layer and enemies being on a scrollable layer: The detection stops working after the game start to scroll. Is there a way to get where the game camera is? I keep having issues with collisions... it all feels buggy or incomplete.
Help! :(

Comments

  • rebumprebump Member Posts: 1,058
    Maybe the following will help formulate a plan. From:

    http://gamesalad.com/wiki/how_tos:gsc_drag_and_drop_movement#modifications_for_non-default_scene_size

    "Since the position of the mouse is relative to the camera view, you will need an offset equal to the position(origin) of the camera. However, the camera attributes are on the Scene layer and thus can only be accessed by actor instances, so you'll need to be a little creative to get those values so you don't have to modify every single actor instance that is in your scene."

    Once you have the coordinates, then some halved screen dimensions subtracted and added (seperate attributes...don't add and subtract to the same set) will get you the current view bounds within the scene I would think.
  • fmarkusfmarkus Member Posts: 42
    Works perfectly! Thanks! I did not know some parameters could be hidden in instances only :(
    Thanks a lot!
Sign In or Register to comment.