C# Class fliXNA_xbox.FlxObject

Inheritance: FlxBasic
显示文件 Open project: konamicode/fliXNA_xbox Class Usage Examples

Public Properties

Property Type Description
acceleration FlxPoint
allowCollisions uint
angle float
angularAcceleration float
angularDrag float
angularVelocity float
drag FlxPoint
elasticity float
health float
height float
immovable bool
last FlxPoint
mass float
maxAngular float
maxVelocity FlxPoint
moves bool
path FlxPath
pathAngle float
pathSpeed float
scrollFactor FlxPoint
touching uint
velocity FlxPoint
wasTouching uint
width float
x float
y float

Protected Properties

Property Type Description
_flicker bool
_flickerTimer float
_pZero FlxPoint
_pathInc int
_pathMode uint
_pathNodeIndex int
_pathRotate bool
_point FlxPoint
_rect FlxRect

Public Methods

Method Description
FlxObject ( float X, float Y, float Width, float Height ) : System

Instantiates a FlxObject

destroy ( ) : void

Override to null out variables manually

draw ( ) : void

Rarely called. Not yet implemented like AS3 Flixel

drawDebug ( FlxCamera Camera = null ) : void

Not yet implemented

flicker ( float Duration = 1.0f ) : void

Flicker this object

followPath ( FlxPath Path, float Speed = 100, uint Mode = PATH_FORWARD, bool AutoRotate = false ) : void
getMidpoint ( FlxPoint Point = null ) : FlxPoint

Retrieve midpoint of this object in world coordinates

getScreenXY ( FlxPoint Point = null, FlxCamera Camera = null ) : FlxPoint

Call this to figure out the on-screen position of the object

hurt ( float Damage ) : void

Reduces the health

isTouching ( uint Direction ) : bool

Check to see if this object is touching a particular surface

justTouched ( uint Direction ) : bool

Check to see if this object just touched a particular surface

onScreen ( FlxCamera Camera = null ) : bool

Check to see if this object is currently on the screen

overlaps ( FlxBasic ObjectOrGroup, bool InScreenSpace = false, FlxCamera Camera = null ) : bool

Checks to see if some FlxObject overlaps this FlxObject or FlxGroup. If the group has a LOT of things in it, it might be faster to use FlxG.ovelaps()

overlapsAt ( float X, float Y, FlxBasic ObjectOrGroup, bool InScreenSpace = false, FlxCamera Camera = null ) : bool

Checks to see if this FlxObject were located at the given position

overlapsPoint ( FlxPoint Point, bool InScreenSpace = false, FlxCamera Camera = null ) : bool

Check to see if a point in 2D world space overlaps this FlxObject

postUpdate ( ) : void

Called right after update()

preUpdate ( ) : void

Called right before update()

reset ( float X, float Y ) : void

Handy function for reviving game objects. Resets their existence flags and position

separate ( FlxObject Object1, FlxObject Object2 ) : bool

The main collision resolution function

separateX ( FlxObject Object1, FlxObject Object2 ) : bool

X-axis component of the object separation process

separateY ( FlxObject Object1, FlxObject Object2 ) : bool

Y-axis component of the object separation process

stopFollowingPath ( bool DestroyPath = false ) : void
update ( ) : void

Protected Methods

Method Description
advancePath ( bool Snap = true ) : FlxPoint
updatePathMotion ( ) : void

Private Methods

Method Description
updateMotion ( ) : void

Internal function for updating the position and speed of this object.

Method Details

FlxObject() public method

Instantiates a FlxObject
public FlxObject ( float X, float Y, float Width, float Height ) : System
X float X-coordinate of the object in space
Y float y-coordinate of the object in space
Width float Desired width of the rectangle
Height float Desired height of the rectangle
return System

advancePath() protected method

protected advancePath ( bool Snap = true ) : FlxPoint
Snap bool
return FlxPoint

destroy() public method

Override to null out variables manually
public destroy ( ) : void
return void

draw() public method

Rarely called. Not yet implemented like AS3 Flixel
public draw ( ) : void
return void

drawDebug() public method

Not yet implemented
public drawDebug ( FlxCamera Camera = null ) : void
Camera FlxCamera Which Camera - currently only one exists
return void

flicker() public method

Flicker this object
public flicker ( float Duration = 1.0f ) : void
Duration float How many seconds
return void

followPath() public method

public followPath ( FlxPath Path, float Speed = 100, uint Mode = PATH_FORWARD, bool AutoRotate = false ) : void
Path FlxPath
Speed float
Mode uint
AutoRotate bool
return void

getMidpoint() public method

Retrieve midpoint of this object in world coordinates
public getMidpoint ( FlxPoint Point = null ) : FlxPoint
Point FlxPoint
return FlxPoint

getScreenXY() public method

Call this to figure out the on-screen position of the object
public getScreenXY ( FlxPoint Point = null, FlxCamera Camera = null ) : FlxPoint
Point FlxPoint Take a FlxPoint object and assign the post-scrolled X and Y values of this object to it
Camera FlxCamera Which Camera - currently only one exists
return FlxPoint

hurt() public method

Reduces the health
public hurt ( float Damage ) : void
Damage float Amount to reduce by
return void

isTouching() public method

Check to see if this object is touching a particular surface
public isTouching ( uint Direction ) : bool
Direction uint Any of the collision flags (e.g. LEFT, FLOOR, etc)
return bool

justTouched() public method

Check to see if this object just touched a particular surface
public justTouched ( uint Direction ) : bool
Direction uint Any of the collision flags (e.g. LEFT, FLOOR, etc)
return bool

onScreen() public method

Check to see if this object is currently on the screen
public onScreen ( FlxCamera Camera = null ) : bool
Camera FlxCamera Which Camera - currently only one exists
return bool

overlaps() public method

Checks to see if some FlxObject overlaps this FlxObject or FlxGroup. If the group has a LOT of things in it, it might be faster to use FlxG.ovelaps()
public overlaps ( FlxBasic ObjectOrGroup, bool InScreenSpace = false, FlxCamera Camera = null ) : bool
ObjectOrGroup FlxBasic The object or group being tested
InScreenSpace bool Whether to take scroll factors into account.
Camera FlxCamera Which Camera - currently only one exists
return bool

overlapsAt() public method

Checks to see if this FlxObject were located at the given position
public overlapsAt ( float X, float Y, FlxBasic ObjectOrGroup, bool InScreenSpace = false, FlxCamera Camera = null ) : bool
X float X position you want to check
Y float Y position you want to check
ObjectOrGroup FlxBasic The object or group being tested
InScreenSpace bool Whether to take scroll factors into account.
Camera FlxCamera Which Camera - currently only one exists
return bool

overlapsPoint() public method

Check to see if a point in 2D world space overlaps this FlxObject
public overlapsPoint ( FlxPoint Point, bool InScreenSpace = false, FlxCamera Camera = null ) : bool
Point FlxPoint The point in world space you want to check
InScreenSpace bool Whether to take scroll factors into account.
Camera FlxCamera Which Camera - currently only one exists
return bool

postUpdate() public method

Called right after update()
public postUpdate ( ) : void
return void

preUpdate() public method

Called right before update()
public preUpdate ( ) : void
return void

reset() public method

Handy function for reviving game objects. Resets their existence flags and position
public reset ( float X, float Y ) : void
X float
Y float
return void

separate() public static method

The main collision resolution function
public static separate ( FlxObject Object1, FlxObject Object2 ) : bool
Object1 FlxObject
Object2 FlxObject
return bool

separateX() public static method

X-axis component of the object separation process
public static separateX ( FlxObject Object1, FlxObject Object2 ) : bool
Object1 FlxObject
Object2 FlxObject
return bool

separateY() public static method

Y-axis component of the object separation process
public static separateY ( FlxObject Object1, FlxObject Object2 ) : bool
Object1 FlxObject
Object2 FlxObject
return bool

stopFollowingPath() public method

public stopFollowingPath ( bool DestroyPath = false ) : void
DestroyPath bool
return void

update() public method

public update ( ) : void
return void

updatePathMotion() protected method

protected updatePathMotion ( ) : void
return void

Property Details

_flicker protected_oe property

Internal helper for Retro-styled flickering
protected bool _flicker
return bool

_flickerTimer protected_oe property

Internal helper for Retro-styled flickering
protected float _flickerTimer
return float

_pZero protected_oe static_oe property

Should always represent (0,0) - useful for different things, for avoideing unnecessary new calls
protected static FlxPoint _pZero
return FlxPoint

_pathInc protected_oe property

Internal helper for node navigation, specifically yoyo and backwards movement
protected int _pathInc
return int

_pathMode protected_oe property

Internal tracker for path behavior flags (looping, horizontal only, etc)
protected uint _pathMode
return uint

_pathNodeIndex protected_oe property

Internal helper, tracks which node of the path this object is moving toward
protected int _pathNodeIndex
return int

_pathRotate protected_oe property

Internal flag for whether the object's angle should be adjusted to the path angle during path follow behavior
protected bool _pathRotate
return bool

_point protected_oe property

Pre-allocated x-y point container to be used however you like
protected FlxPoint _point
return FlxPoint

_rect protected_oe property

Pre-allocated rectangle container to be used however you like
protected FlxRect,fliXNA_xbox _rect
return FlxRect

acceleration public_oe property

How fast the speed of this object is changing. Useful for smooth movement and gravity
public FlxPoint acceleration
return FlxPoint

allowCollisions public_oe property

Bit field of flags (use with UP, DOWN, LEFT, RIGHT, etc) indicating collision directions. Use bitwise operators to check the values stored here. Useful for things like one-way platforms (e.g. allowCollisions = UP;) The accessor "solid" just flips this variable between NONE and ANY/
public uint allowCollisions
return uint

angle public_oe property

The angle of the sprite, used for rotation
public float angle
return float

angularAcceleration public_oe property

How fast the spin should change
public float angularAcceleration
return float

angularDrag public_oe property

Like drag but for spinning
public float angularDrag
return float

angularVelocity public_oe property

How fast you want the sprite to spin
public float angularVelocity
return float

drag public_oe property

This is like deceleration that is only applied when acceleration is not affecting the sprite.
public FlxPoint drag
return FlxPoint

elasticity public_oe property

The bounciness of this object, Only affects collisions. Default is 0, or "not bouncy at all."
public float elasticity
return float

health public_oe property

Handy for storing health percentage or armor points or whatever
public float health
return float

height public_oe property

The height of this object
public float height
return float

immovable public_oe property

Whether this object will move/alter position after a collision
public bool immovable
return bool

last public_oe property

Important variable for collision processing. Set automatically during preUpdate()
public FlxPoint last
return FlxPoint

mass public_oe property

Virtual mass of this object. Defauly value is 1. Currently only used with elasticity during collision resolution. Change at your own risk; effects seem crazy unpredictable so far!
public float mass
return float

maxAngular public_oe property

Use in conjunction with angularAcceleration fir fluid spin speed control
public float maxAngular
return float

maxVelocity public_oe property

Max speed of this object
public FlxPoint maxVelocity
return FlxPoint

moves public_oe property

Set this to false if you want to skip automatic motion/movement stuff. Default is true for FlxObject and FlxSprite. Default is false for FlxText, FlxTileblock, FlxTilemap, and FlxSound.
public bool moves
return bool

path public_oe property

A reference to a path object. Null by default, assigned by followPath()
public FlxPath path
return FlxPath

pathAngle public_oe property

The angle in degrees between this object and the next node, where 0 is directly North, 90 is East
public float pathAngle
return float

pathSpeed public_oe property

The speed at which the object is moving on the path. When an object completes a non-looping path circuit, the pathSpeed will be zeroed out, but the path reference will NOT be nulled out. So pathSpeed is a good way to check if this object is currently following a path of not
public float pathSpeed
return float

scrollFactor public_oe property

How much this object is affected by the camera subsystem. 0 means it never moves, like a HUD element or background graphic. 1 means it scrolls along at the same speed as the foreground layer. (1,1) by default. CURRENTLY NOT IMPLEMENTED
public FlxPoint scrollFactor
return FlxPoint

touching public_oe property

Bit field of flags (use with UP, DOWN, LEFT, RIGHT, etc) indicating surface contacts. Use bitwise operators to check the values stored here, or use touching(), justStartedTouching(), etc. You can even use them broadly as boolean values if you're feeling saucy!
public uint touching
return uint

velocity public_oe property

Basic speed of this object
public FlxPoint velocity
return FlxPoint

wasTouching public_oe property

Bit field of flags (use with UP, DOWN, LEFT, RIGHT, etc) indicating surface contacts from the previous game loop step. Use bitwise operators to check the values stored here, or use touching(), justStartedTouching(), etc. You can even use them broadly as boolean values if you're feeling saucy!
public uint wasTouching
return uint

width public_oe property

The width of this object
public float width
return float

x public_oe property

X position of the upper left corner of this object in world space
public float x
return float

y public_oe property

Y position of the upper left corner of this object in world space
public float y
return float