Anyone have Proximity rules?
TwistedMech
Member Posts: 408
is there a way to know if an actor is in the viewable window?
Comments
If your scene is NOT scrollable, you simply need to check that the Actor's X is between 0 and 480, and that the Actor's Y is between 0 and 320.
However, if your screen IS scrollable, you'll need to place another Actor in the Scene that keeps track of the Camera coordinates. You can place the actor just outside the visible area - the lower left works nicely. You'll need to create two global properties (real) called something like CameraX and CameraY.
Once you drag an Actor into the Scene, it becomes an INSTANCE of the Actor. Instances have access to properties of the Scene (the Actor's Prototype does not).
Double-click on an Actor in the Scene to access its properties.
Click the padlock to edit the behaviors of the Instance.
In the "Camera Tracker" instance, you'll need to Constrain the Camera's OriginX to the global CameraX. Do the same for the Camera's OriginY.
Now that you have those coordinates tracked, you simply need to check that the Actor's X is between game.CameraX and game.CameraX + 480, and that the Actor's Y is between game.CameraY and game.CameraY + 320.
Hope this helps!
Joe
If your scene is NOT scrollable, you simply need to check that the Actor's X is between 0 and 480, and that the Actor's Y is between 0 and 320.
However, if your screen IS scrollable, you'll need to place another Actor in the Scene that keeps track of the Camera coordinates. You can place the actor just outside the visible area - the lower left works nicely. You'll need to create two global properties (real) called something like CameraX and CameraY.
Once you drag an Actor into the Scene, it becomes an INSTANCE of the Actor. Instances have access to properties of the Scene (the Actor's Prototype does not).
Double-click on an Actor in the Scene to access its properties.
Click the padlock to edit the behaviors of the Instance.
In the "Camera Tracker" instance, you'll need to Constrain the Camera's OriginX to the global CameraX. Do the same for the Camera's OriginY.
Now that you have those coordinates tracked, you simply need to check that the Actor's X is between game.CameraX and game.CameraX + 480, and that the Actor's Y is between game.CameraY and game.CameraY + 320.
Hope this helps!
Joe
If your scene is NOT scrollable, you simply need to check that the Actor's X is between 0 and 480, and that the Actor's Y is between 0 and 320.
However, if your screen IS scrollable, you'll need to place another Actor in the Scene that keeps track of the Camera coordinates. You can place the actor just outside the visible area - the lower left works nicely. You'll need to create two global properties (real) called something like CameraX and CameraY.
Once you drag an Actor into the Scene, it becomes an INSTANCE of the Actor. Instances have access to properties of the Scene (the Actor's Prototype does not).
Double-click on an Actor in the Scene to access its properties.
Click the padlock to edit the behaviors of the Instance.
In the "Camera Tracker" instance, you'll need to Constrain the Camera's OriginX to the global CameraX. Do the same for the Camera's OriginY.
Now that you have those coordinates tracked, you simply need to check that the Actor's X is between game.CameraX and game.CameraX + 480, and that the Actor's Y is between game.CameraY and game.CameraY + 320.
Hope this helps!
Joe
If your scene is NOT scrollable, you simply need to check that the Actor's X is between 0 and 480, and that the Actor's Y is between 0 and 320.
However, if your screen IS scrollable, you'll need to place another Actor in the Scene that keeps track of the Camera coordinates. You can place the actor just outside the visible area - the lower left works nicely. You'll need to create two global properties (real) called something like CameraX and CameraY.
Once you drag an Actor into the Scene, it becomes an INSTANCE of the Actor. Instances have access to properties of the Scene (the Actor's Prototype does not).
Double-click on an Actor in the Scene to access its properties.
Click the padlock to edit the behaviors of the Instance.
In the "Camera Tracker" instance, you'll need to Constrain the Camera's OriginX to the global CameraX. Do the same for the Camera's OriginY.
Now that you have those coordinates tracked, you simply need to check that the Actor's X is between game.CameraX and game.CameraX + 480, and that the Actor's Y is between game.CameraY and game.CameraY + 320.
Hope this helps!
Joe
If your scene is NOT scrollable, you simply need to check that the Actor's X is between 0 and 480, and that the Actor's Y is between 0 and 320.
However, if your screen IS scrollable, you'll need to place another Actor in the Scene that keeps track of the Camera coordinates. You can place the actor just outside the visible area - the lower left works nicely. You'll need to create two global properties (real) called something like CameraX and CameraY.
Once you drag an Actor into the Scene, it becomes an INSTANCE of the Actor. Instances have access to properties of the Scene (the Actor's Prototype does not).
Double-click on an Actor in the Scene to access its properties.
Click the padlock to edit the behaviors of the Instance.
In the "Camera Tracker" instance, you'll need to Constrain the Camera's OriginX to the global CameraX. Do the same for the Camera's OriginY.
Now that you have those coordinates tracked, you simply need to check that the Actor's X is between game.CameraX and game.CameraX + 480, and that the Actor's Y is between game.CameraY and game.CameraY + 320.
Hope this helps!
Joe
If your scene is NOT scrollable, you simply need to check that the Actor's X is between 0 and 480, and that the Actor's Y is between 0 and 320.
However, if your screen IS scrollable, you'll need to place another Actor in the Scene that keeps track of the Camera coordinates. You can place the actor just outside the visible area - the lower left works nicely. You'll need to create two global properties (real) called something like CameraX and CameraY.
Once you drag an Actor into the Scene, it becomes an INSTANCE of the Actor. Instances have access to properties of the Scene (the Actor's Prototype does not).
Double-click on an Actor in the Scene to access its properties.
Click the padlock to edit the behaviors of the Instance.
In the "Camera Tracker" instance, you'll need to Constrain the Camera's OriginX to the global CameraX. Do the same for the Camera's OriginY.
Now that you have those coordinates tracked, you simply need to check that the Actor's X is between game.CameraX and game.CameraX + 480, and that the Actor's Y is between game.CameraY and game.CameraY + 320.
Hope this helps!
Joe
If your scene is NOT scrollable, you simply need to check that the Actor's X is between 0 and 480, and that the Actor's Y is between 0 and 320.
However, if your screen IS scrollable, you'll need to place another Actor in the Scene that keeps track of the Camera coordinates. You can place the actor just outside the visible area - the lower left works nicely. You'll need to create two global properties (real) called something like CameraX and CameraY.
Once you drag an Actor into the Scene, it becomes an INSTANCE of the Actor. Instances have access to properties of the Scene (the Actor's Prototype does not).
Double-click on an Actor in the Scene to access its properties.
Click the padlock to edit the behaviors of the Instance.
In the "Camera Tracker" instance, you'll need to Constrain the Camera's OriginX to the global CameraX. Do the same for the Camera's OriginY.
Now that you have those coordinates tracked, you simply need to check that the Actor's X is between game.CameraX and game.CameraX + 480, and that the Actor's Y is between game.CameraY and game.CameraY + 320.
Hope this helps!
Joe
If your scene is NOT scrollable, you simply need to check that the Actor's X is between 0 and 480, and that the Actor's Y is between 0 and 320.
However, if your screen IS scrollable, you'll need to place another Actor in the Scene that keeps track of the Camera coordinates. You can place the actor just outside the visible area - the lower left works nicely. You'll need to create two global properties (real) called something like CameraX and CameraY.
Once you drag an Actor into the Scene, it becomes an INSTANCE of the Actor. Instances have access to properties of the Scene (the Actor's Prototype does not).
Double-click on an Actor in the Scene to access its properties.
Click the padlock to edit the behaviors of the Instance.
In the "Camera Tracker" instance, you'll need to Constrain the Camera's OriginX to the global CameraX. Do the same for the Camera's OriginY.
Now that you have those coordinates tracked, you simply need to check that the Actor's X is between game.CameraX and game.CameraX + 480, and that the Actor's Y is between game.CameraY and game.CameraY + 320.
Hope this helps!
Joe
If your scene is NOT scrollable, you simply need to check that the Actor's X is between 0 and 480, and that the Actor's Y is between 0 and 320.
However, if your screen IS scrollable, you'll need to place another Actor in the Scene that keeps track of the Camera coordinates. You can place the actor just outside the visible area. You'll need to create two global properties (real) called something like CameraX and CameraY.
Once you drag an Actor into the Scene, it becomes an INSTANCE of the Actor. Instances have access to properties of the Scene (the Actor's Prototype does not).
Double-click on an Actor in the Scene to access its properties.
Click the padlock to edit the behaviors of the Instance.
In the "Camera Tracker" instance, you'll need to Constrain the Camera's OriginX to the global CameraX. Do the same for the Camera's OriginY.
Now that you have those coordinates tracked, you simply need to check that the Actor's X is between game.CameraX and game.CameraX + 480, and that the Actor's Y is between game.CameraY and game.CameraY + 320.
Hope this helps!
Joe