#include <PropaneActor.h>
Public Member Functions | |
| Actor (SpriteManager *sprites) | |
| Create with a given sprite manager as parent. | |
| virtual | ~Actor () |
| Destructor for this actor. | |
| void | setAnimation (int startFrame, int numFrames, float frameDelay) |
| Allows you to override animation values permanently. This will not affect any temporary frames currently active. | |
| virtual void | draw (int x, int y) |
| Draw the actor, based on the provided camera coordinate in worldspace. (x,y) is the CENTRE of what the camera is LOOKING AT (i.e. where the camera "is"). | |
| virtual void | move (float dx, float dy) |
| Move the actor some number of world units. | |
| virtual void | temporaryFrame (int frame) |
| Allows you to temporarily override standard animation, for a single frame. Resets the animation timer. | |
| virtual void | resetAnimation () |
| Resets your animation to base values, including resetting the timer and clearing out temporary frames. | |
| virtual bool | rotateTowards (double maxRot, double goal) |
| Make the actor face a certain angle "over time". Very useful for smooth, human-like turning. | |
| virtual void | rotateFacing (float x, float y) |
| Forces the actor to instantly turn towards a given (x,y) in worldspace. | |
| float | getX () |
| Get the actor's current horizontal (east-west) world coordinate. | |
| float | getY () |
| Get the actor's current vertical (north-south) world coordinate. | |
| float | getWidth () |
| Get the actor's width in world units. This affects drawing and collision. | |
| float | getHeight () |
| Get the actor's height in world units. This affects drawing and collision. | |
| float | getForwardX (float delta, float offsetx=0.0f, float offsety=0.0f) |
| Gets a point ahead of the actor at "delta" distance. Use offsetx and offsety to get a point on the actor ahead (for example, their hand to place a gun in it). | |
| float | getForwardY (float delta, float offsetx=0.0f, float offsety=0.0f) |
| Gets a point ahead of the actor at "delta" distance. Use offsetx and offsety to get a point on the actor ahead (for example, their hand to place a gun in it). | |
| virtual double | getRotation () |
| Get current actor rotation (in degrees). | |
| virtual double | angleTowards (float wx, float wy) |
| Get the actor's angle towards a certain location in worldspace. | |
| virtual double | angleDistance (double angle1, double angle2) |
| Get the arc length required to turn towards a world loc (in terms of degrees). | |
| virtual double | angleOutOf360 (double angle) |
| Get an angle in degrees out of 360. | |
| void | setX (float newX) |
| Set the actor's X (horizontal, east-west) coordinate in world units. | |
| void | setY (float newY) |
| Sets the actor's Y (vertical, north-south) coordinate in world units. | |
| void | setWidth (float width) |
| Sets actor width in world units, affecting collision and rendering. | |
| void | setHeight (float height) |
| Sets actor height in world units, affecting collision and rendering. | |
| void | setXYWH (float x, float y, float width, float height) |
| Sets actor (X,Y) position and dimensions at the same time. | |
| virtual void | setRotation (double degrees) |
| Instantly sets the actor's rotation to a given angle in degrees. | |
| virtual void | rotate (double dRot) |
| Changes the actor's current rotation by dRot degrees. | |
| virtual bool | collision (Actor *actor2) |
| Returns true if it collided with another Actor object. Uses the other object's getX/getY/getWidth/getHeight methods to do so. | |
| int | getFrame () |
| Gets the sprite that should be used for rendering this actor's current animation frame. | |
| void | updateAnimation (float delta) |
| Updates the animation timer, incrementing frames as necessary. Delta is in seconds. | |
| virtual void | handleTrigger (std::string trigger_uid) |
| For purposes of scripting, take an event trigger UID and perform a variable action on it. Interface method. | |
Protected Member Functions | |
| float | DegToRad (double degree) |
| Converts rotations in degrees to radians. | |
| double | rotationOutOf360 () |
| Returns the actor's current rotation out of 360 (in degrees). | |
Protected Attributes | |
| int | startFrame |
| The first frame in the animation sequence. | |
| float | frameTimer |
| The amount of time the current frame has spent. | |
| float | frameDelay |
| The amount of time a frame can take before it advances. | |
| int | curFrame |
| The offset from the first frame in the series. | |
| int | numFrames |
| How high the offset can get before it loops back to 0 (first frame). | |
| float | x |
| X coordinate, world units. | |
| float | y |
| Y coordinate, world units. | |
| float | w |
| Width, world units (collision & render). | |
| float | h |
| Height, world units (collision & render). | |
| double | rotation |
| Current actor rotation (in degrees). | |
| bool | inTemp |
| Are we in a temporary frame? | |
| int | tempFrame |
| The id of the temporary frame. | |
| SpriteManager * | myMgr |
| A pointer to the sprite manager that will render this actor, including the raw textures that tempFrame/startFrame reference. | |
|
|
Create with a given sprite manager as parent. Constructs a new Actor that references a given SpriteManager. In future releases of PI, the requirement to provide a SpriteManager will be lifted and the SpriteManager itself, or another class, will handle actor rendering.
|
|
|
Destructor for this actor. Stub destructor. Does nothing. |
|
||||||||||||
|
Get the arc length required to turn towards a world loc (in terms of degrees). Get the number of degrees "distance" we have from a given angle.
|
|
|
Get an angle in degrees out of 360. Convert an angle of any number to [0,360) This just uses fmodf, which is a change from Freezer which implemented it very dumbly with a loop.
|
|
||||||||||||
|
Get the actor's angle towards a certain location in worldspace. Get the angle from an actor to a given location in world space.
|
|
|
Returns true if it collided with another Actor object. Uses the other object's getX/getY/getWidth/getHeight methods to do so. Simple AABB collision between two actors.
|
|
|
Converts rotations in degrees to radians. Convert degrees to radians.
|
|
||||||||||||
|
Draw the actor, based on the provided camera coordinate in worldspace. (x,y) is the CENTRE of what the camera is LOOKING AT (i.e. where the camera "is"). Renders the actor to screen using its current sprite, rotation, height, width, and location, using the camera (px,py). To use this method, imagine (px,py) is the point in the centre of the viewport. This is the point you are "looking at" in the world, and the actors will be drawn relative to this point.
|
|
||||||||||||||||
|
Gets a point ahead of the actor at "delta" distance. Use offsetx and offsety to get a point on the actor ahead (for example, their hand to place a gun in it). Get the X-coordinate of the position in world space that is ahead of the actor. Use offsetX/offsetY to manipulate the position on the player that is projected; Glow uses this function to make visible weapons look correct when the player rotates, and to spawn bullets at the correct location relative to the held gun.
|
|
||||||||||||||||
|
Gets a point ahead of the actor at "delta" distance. Use offsetx and offsety to get a point on the actor ahead (for example, their hand to place a gun in it). Get the Y-coordinate of the position in world space that is ahead of the actor. Use offsetX/offsetY to manipulate the position on the player that is projected; Glow uses this function to make visible weapons look correct when the player rotates, and to spawn bullets at the correct location relative to the held gun.
|
|
|
Gets the sprite that should be used for rendering this actor's current animation frame. Get the current frame being used by the actor, which will be used to render it.
|
|
|
Get the actor's height in world units. This affects drawing and collision. Get the actor height in the world.
|
|
|
Get current actor rotation (in degrees). Get the actor's rotation in degrees.
|
|
|
Get the actor's width in world units. This affects drawing and collision. Get the actor width in the world.
|
|
|
Get the actor's current horizontal (east-west) world coordinate. Get the actor x-location in the world.
|
|
|
Get the actor's current vertical (north-south) world coordinate. Get the actor y-location in the world.
|
|
||||||||||||
|
Move the actor some number of world units. Moves the actor the specified amount. After this function is finished, the new position will be (x + dx, y + dy)
|
|
|
Resets your animation to base values, including resetting the timer and clearing out temporary frames. Reset animation to default values, clearing temporary frames, timers, current frames. Does NOT clear the defined animation loop, only the current 'status' of the animation. |
|
|
Changes the actor's current rotation by dRot degrees. Adjusts the actor's rotation by the given number of degrees.
|
|
||||||||||||
|
Forces the actor to instantly turn towards a given (x,y) in worldspace. Automatically set the actor's rotation to point at a given world space location. Uses angleTowards.
|
|
||||||||||||
|
Make the actor face a certain angle "over time". Very useful for smooth, human-like turning. Gradually rotate towards an angle. Call this over time to have a "smooth" turning motion towards things, like in Freezer and Glow.
|
|
|
Returns the actor's current rotation out of 360 (in degrees). Uses angleOutOf360 to convert the actor's rotation to [0,360).
|
|
||||||||||||||||
|
Allows you to override animation values permanently. This will not affect any temporary frames currently active. Reset the animation loop's properties. Does not reset current animation values, so you should call reset() after using this function.
|
|
|
Sets actor height in world units, affecting collision and rendering. Set the actor's rendering and collision height, in world units. Silently fails if nh < 0
|
|
|
Instantly sets the actor's rotation to a given angle in degrees. Set the actor rotation in degrees.
|
|
|
Sets actor width in world units, affecting collision and rendering. Set the actor's rendering and collision width, in world units. Silently fails if nw < 0
|
|
|
Set the actor's X (horizontal, east-west) coordinate in world units. Set the actor X coordinate in the world.
|
|
||||||||||||||||||||
|
Sets actor (X,Y) position and dimensions at the same time. Set the location and proportions at once.
|
|
|
Sets the actor's Y (vertical, north-south) coordinate in world units. Set the actor Y coordinate in the world.
|
|
|
Allows you to temporarily override standard animation, for a single frame. Resets the animation timer. Interrupt animation temporarily, reset the frame timer, and substitute a frame. Useful for "momentary" actions like firing a gun or taking a hit. Once the timer "ticks over" to the next frame, this frame will be reset and the regular animation loop will continue as normal.
|
|
|
Updates the animation timer, incrementing frames as necessary. Delta is in seconds. Increments frame timer and automatically clears frame timer and increments frame in animation as necessary. Also loops automatically.
|
1.4.6