Click or drag to resize
SpriteBase Class
Base class for all sprite definitions.
Inheritance Hierarchy

Namespace: (Default Namespace)
Assembly: Default (in Default.exe) Version: 1.0.0.0
Syntax
C#
[SerializableAttribute]
public abstract class SpriteBase : GeneralRules

The SpriteBase type exposes the following members.

Constructors
  NameDescription
Public methodSpriteBase
Constructs a new sprite instance given all its base properties.
Top
Methods
  NameDescription
Public methodCode exampleAccelerateByInputs
Accelerate this sprite according to which directional inputs are on/pressed.
Public methodCode exampleAddSpriteHere
Create a new (dynamic) instance of the specified sprite positioned such that HotSpot on the created sprite overlaps Location on this sprite.
Public methodAlterXVelocity
Increment or decrement horizontal velocity
Public methodAlterYVelocity
Increment or decrement vertical velocity
Public methodAnimate
Advance the animation frame of this sprite according to its velocity or a constant rate.
Public methodApplyLights
Use properties of the sprites in the specified category to configure real-time lighting on the display for the current frame.
(Inherited from GeneralRules.)
Public methodBlocked
Determines if the sprite is blocked from moving freely in a particular direction by solidity on the layer.
Public methodCalculateRotatedState
Return a state that is in the same group of states as the sprite's current state, but possibly pointing a different direction.
Public methodCanReturnToPreviousMap
Determines if there is a previous map to return to.
(Inherited from GeneralRules.)
Public methodChangeCounter
Change a counter's value with a pre-defined operation.
(Inherited from GeneralRules.)
Public methodClearAllMessages
Clears all active messages from the display.
(Inherited from GeneralRules.)
Public methodClearInputs
Turns off all current inputs on this sprite.
Public methodClearOverlay
Turn off the overlay map.
(Inherited from GeneralRules.)
Public methodClearParameters
Resets all parameter values defined on the specific sprite definition to 0.
Public methodClicked
Determines if the specified mouse button is pressed.
(Inherited from GeneralRules.)
Public methodDeactivate
Deactivate this sprite.
Public methodDeactivateTargetSpriteFor
Deactivate the sprite currently selected as the target for the specified name and clear the sprite selected for that target name.
(Inherited from GeneralRules.)
Public methodDeleteSave
Empties the specified save slot.
(Inherited from GeneralRules.)
Public methodDragMap
When the mouse drags over the display, scroll the map along with it.
(Inherited from GeneralRules.)
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodExcludeCounterFromSaveUnit
Exclude the specified counter from the SaveUnit that will be saved with the next call to SaveGame(Int32, Boolean).
(Inherited from GeneralRules.)
Public methodExcludeMapFromSaveUnit
Remove the specified map in from the SaveUnit that will be saved with the next call to SaveGame(Int32, Boolean).
(Inherited from GeneralRules.)
Public methodGetBounds
Returns information about the visual boundaries of the sprite's currently displayed frame(s).
Public methodGetCurrentFramesetFrames
Get a list of frameset frames that the sprite is currently displaying
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetNearestSpriteIndex
Compute the index of the nearest active sprite from the specified category and return it.
Public methodGetPolarStateByVector
Calculate the state that a rotating sprite should use in order to point in the direction it is currently traveling
Public methodGetRandomNumber
Return a random number within a specified range.
(Inherited from GeneralRules.)
Public methodGetRelativePosition
Calculate the absolute position of a specified RelativePosition value with respect to this sprite.
Public methodGetSelectedTargetFor
Returns the sprite currently selected for the specified target name.
(Inherited from GeneralRules.)
Public methodGetTargetParameterFor
Get the value of a numeric property or parameter on a sprite selected with SelectTargetSpriteFor(SpriteCollection, Int32, String).
(Inherited from GeneralRules.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodIncludeCounterInSaveUnit
Include the specified counter in the SaveUnit that will be saved with the next call to SaveGame(Int32, Boolean).
(Inherited from GeneralRules.)
Public methodIncludeInSaveUnit
Includes a specified set of objects in the SaveUnit that will be saved with the next call to SaveGame(Int32, Boolean).
(Inherited from GeneralRules.)
Public methodIncludeMapInSaveUnit
Include the specified map in the SaveUnit that will be saved with the next call to SaveGame(Int32, Boolean).
(Inherited from GeneralRules.)
Public methodIsInputPressed
Determine if the specified input is being pressed for this sprite.
Public methodIsInState
Determines if the sprite is in the specified range of states.
Public methodIsKeyPressed
Determines if a specified key is being pressed.
(Inherited from GeneralRules.)
Public methodIsMapFlagOn
Determine if the specified map-specific flag on the current map is on.
(Inherited from GeneralRules.)
Public methodIsMouseButtonPressed
Determines if the specified mouse button is pressed.
(Inherited from GeneralRules.)
Public methodIsMoving
Determines if the sprite is moving in the specified direction at all.
Public methodIsOnTile
Determines if a tile at the sprite's current position is a member of the specified category.
Public methodIsPointBlocked
Determines if the specified point within a sprite is blocked from moving in a particular direction by the specified number of pixels.
Public methodIsRidingPlatform
Determine if the sprite is riding another sprite
Public methodIsSpriteForTargetOfType
Determine if the sprite selected for the specified target (selected with SelectTargetSpriteFor) is of the specified type.
(Inherited from GeneralRules.)
Public methodIsTargetSpriteSelectedFor (Inherited from GeneralRules.)
Public methodLandDownOnPlatform
Tests to see if this sprite is landing on a platform (from above), and if so, make the sprite ride the platform.
Public methodLimitFrameRate
Limit the frame rate of the game to the specified number of frames per second. Call this only once per frame.
(Inherited from GeneralRules.)
Public methodLimitVelocity
If the velocity of the sprite is more than the specified maximum, normalize it so that it's going the same direction, but at no more that the specified maximum speed.
Public methodLoadGame
Restore the state of the objects contained in the specified save slot.
(Inherited from GeneralRules.)
Public methodCode exampleLogDebugLabel
Write a string to the debug output without moving to the next line.
(Inherited from GeneralRules.)
Public methodCode exampleLogDebugValue
Write a number to the debug output and move to the next line.
(Inherited from GeneralRules.)
Public methodMapKeyToInput
Associates the state of the specified keyboard key with the specified input on this sprite.
Public methodMapMouseToSprite
Move the sprite to the position of the mouse cursor and set the sprite's button inputs based on mouse button states.
Public methodMapPlayerToInputs
Associate the state of the input device for the specified player with the inputs on this sprite.
Public methodMoveByVelocity
Move this sprite according to its current velocity
Public methodPolarAccelerate
Accelerate a rotating sprite in the direction that it is aiming.
Public methodProcessRules
Execute the rules for this sprite if they have not already been executed this frame
Public methodPushSprite
Alter the velocity of TargetSprite to plan to move out of the way of this sprite if TargetSprite is obstructing this sprite.
Public methodPushSpriteIntoView
Alter this sprite's velocity so that it remains within the map's visible area or within the scroll margins, according to this sprite's layer's position within the map.
Public methodPushTowardCategory
Push this sprite toward a sprite in the specified category.
Public methodPushTowardSprite
Push this sprite toward a specified sprite.
Public methodQuitGame
Quit the game by closing the main window.
(Inherited from GeneralRules.)
Public methodReactToInertia
Reduces the sprite's velocity to simulate friction.
Public methodReactToPlatform
Adjust this sprite's velocity according to the motion of the platform it is riding
Public methodReactToPush
Alter the velocity of this sprite to plan to move out of the way of sprites in Pushers if this sprite is obstructing sprites in Pushers.
Public methodReactToPushback
Alter the velocity of this sprite to plan to move out of the way of sprites in Pushers but if this sprite is planning to overlap a sprite in Pushers, only after those sprites have processed their rules (usually to react to this sprite's pushing first).
Public methodReactToSolid
Alter the sprite's velocity to react to solid areas on the map.
Public methodRemoveFromCategories
Remove the sprite from its designated categories. USE ONLY on dynamically added sprites.
Public methodResetLights
Reset all light sources to initial default behavior.
(Inherited from GeneralRules.)
Public methodReturnToPreviousMap
Return to the map that was active before the last SwitchToMap(Type, Boolean).
(Inherited from GeneralRules.)
Public methodRotateVelocity
Redirect this sprite's velocity to be 100% in the direction that it is facing.
Public methodSaveExists
Determines if saved game data exists in the specified slot.
(Inherited from GeneralRules.)
Public methodSaveGame
Save the current SaveUnit into the specified save slot.
(Inherited from GeneralRules.)
Public methodScrollSpriteIntoView
Scroll all layers on this sprite's layer's map so that the sprite is within visible area of the map.
Public methodSelectLastCreatedSprite
Select the most recently created sprite to be the target of SetTargetParameter(String, Int32).
(Inherited from GeneralRules.)
Public methodSelectLastCreatedSpriteFor
Selects the most recently created sprite to be the target of SetTargetParameterFor(String, Int32, String) or GetTargetParameterFor(String, String).
(Inherited from GeneralRules.)
Public methodSelectTargetSprite
Selects a sprite within a collection, using a 0-based index, to be the target of SetTargetParameter(String, Int32).
(Inherited from GeneralRules.)
Public methodSelectTargetSpriteFor
Selects a sprite within a collection, using a 0-based index, to be the target of SetTargetParameterFor(String, Int32, String). TargetName allows any number of unique targets to be selected by assigning unique names.
(Inherited from GeneralRules.)
Public methodSetCategorySpriteState
Sets the current state of a sprite based on a category and index into the category.
(Inherited from GeneralRules.)
Public methodSetInputState
Turns on or off the specified input on this sprite.
Public methodSetInputsTowardCategory
Set the state of the directional inputs on this sprite to move toward the specified sprite in a category.
Public methodSetInputsTowardSprite
Set the state of the directional inputs on this sprite to move toward the specified sprite.
Public methodSetMapFlag
Turn on or off a flag associated with the current map.
(Inherited from GeneralRules.)
Public methodSetMessageBackground
Sets the background for new messages added with ShowMessage(String).
(Inherited from GeneralRules.)
Public methodSetMessageDismissal
Determines which player and which button will dismiss newly created messages.
(Inherited from GeneralRules.)
Public methodSetMessageFont
Set the tileset used as the source for characters in messages.
(Inherited from GeneralRules.)
Public methodSetMessagePosition
Determines where newly created messages appear.
(Inherited from GeneralRules.)
Public methodSetOverlay
Set the overlay map.
(Inherited from GeneralRules.)
Public methodSetSolidity
Set the solidity rules to which the sprite is currently reacting.
Public methodSetTargetMapFlag
Turn on or off a flag associated with the specified map.
(Inherited from GeneralRules.)
Public methodSetTargetParameter
Set the value of a numeric property or parameter on a sprite selected with SelectTargetSprite(SpriteCollection, Int32) to the specified value.
(Inherited from GeneralRules.)
Public methodSetTargetParameterFor
Set the value of a numeric property or parameter on a sprite selected with SelectTargetSpriteFor(SpriteCollection, Int32, String) to the specified value.
(Inherited from GeneralRules.)
Public methodSetViewLayout
Sets the layout of multiple views for the current map.
(Inherited from GeneralRules.)
Public methodShowMessage
Adds a message to the display.
(Inherited from GeneralRules.)
Public methodSnapToGround
Ensure the sprite stays in contact with the ground by altering its velocity to snap down onto the ground when it is close to the ground.
Public methodStopRiding
Stop riding the sprite that this sprite is currently riding, if any.
Public methodSwitchToMap
Sets a different map as the one to be drawn on the game display.
(Inherited from GeneralRules.)
Public methodSwitchToState
Switch the sprite to the the specified state, ensuring that the sprite doesn't hit a solid.
Public methodTestCollisionMask
Determine whether the sprite's collision mask is overlapping part of any sprite in the specified category.
Public methodTestCollisionRect(SpriteBase)
Determine if this sprite is planning to overlap the target sprite.
Public methodTestCollisionRect(SpriteCollection)
Determine whether the solidity rectangle of the sprite overlaps that of any sprite in the specified category.
Public methodTileActivateSprite
Activate the next inactive sprite from a category at the coordinates of a tile being touched by the sprite.
Public methodTileAddSprite
Create a new (dynamic) instance of the specified sprite type at the coordinates of a tile being touched by the player.
Public methodTileCategoryTouched
Determine if the sprite is touching a tile in the specified category (requires TouchTiles(TileCategoryName)).
Public methodTileChange
Change tiles of the specified type that the sprite is touching to another tile (requires TouchTiles(TileCategoryName)).
Public methodTileChangeTouched
Change the tile specified by TouchingIndex that is being touched by the sprite to another tile (requires TouchTiles(TileCategoryName)).
Public methodTileTake
Determine if the sprite is touching the specified tile, and if so, "take" it and increment a counter (requires TouchTiles(TileCategoryName)).
Public methodCode exampleTileTouchingIndex
Find the next unprocessed tile of the specified type (requires TouchTiles(TileCategoryName)).
Public methodTileUseUp
Make the specified tile behave like it is "using up" one of the items tracked by the specified counter (requires TouchTiles(TileCategoryName)).
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodCode exampleTouchTiles
Collects information about tiles the sprite is currently touching.
Public methodUnloadBackgroundMaps
Unload all maps that aren't currently visible.
(Inherited from GeneralRules.)
Public methodUnloadMap
Unloads the specified map.
(Inherited from GeneralRules.)
Top
Fields
  NameDescription
Public fieldcolor
Public fielddx
Horizontal velocity of the sprite in pixels per frame
Public fielddy
Vertical velocity of the sprite in pixels per frame
Public fieldframe
Numeric value corresponding to the sprite's current frame.
Public fieldinputs
Stores the inputs that are currently being "pressed" on this sprite.
Public fieldisActive
Determines if this sprite is currently active.
Public fieldLocalDX
Horizontal velocity relative to the sprite's environment (like a platform)
Public fieldLocalDY
Vertical velocity relative to the sprite's environment
Public fieldoldinputs
Remembers the inputs that were active on this sprite in the previous frame
Public fieldoldX
The value of this sprite's x coordinate on the previous frame.
Public fieldoldY
The value of this sprite's y coordinate on the previous frame.
Public fieldProcessed
Determines if this sprite's definition's rules have been processed yet this frame
Public fieldRidingOn
Stores the platform sprite (the sprite that this sprite rides on). If not set, then the sprite is not riding anything.
Public fieldCode examplestate
Numeric value corresponding to the sprite's current state.
Public fieldTouchedTiles
A collection of tiles being processed by TouchTiles(TileCategoryName) and other rules related to tile interactions.
Public fieldx
Horizontal coordinate of the sprite within its layer.
Public fieldy
Vertical coordinage of the sprite within its layer.
Top
Properties
  NameDescription
Public propertyCurrentState
Retrieves information about the state that the sprite is currently in.
Public propertyCurrentView
If multiple views are visible, this determines which view is currently active.
(Inherited from GeneralRules.)
Public propertyCode exampleItem
Returns information about a specified state of this sprite
Public propertyModulateAlpha
Affects the sprite's visibility.
Public propertyModulateBlue
Affects the output of blue when this sprite is drawn.
Public propertyModulateGreen
Affects the output of green when this sprite is drawn.
Public propertyModulateRed
Affects the output of red when this sprite is drawn.
Public propertyOldPixelX
The horizontal pixel coordinate that the sprite was at on the previous frame
Public propertyOldPixelY
The vertical pixel coordinate that the sprite was at on the previous frame
Public propertyParentLayer
Retrieves information about the layer in which the sprite resides.
(Overrides GeneralRulesParentLayer.)
Public propertyPixelX
Horizontal position of the sprite within the layer rounded toward zero to yield an integer.
Public propertyPixelY
Vertical position of the sprite within the layer rounded toward zero to yield an integer.
Public propertyProposedPixelX
The horizontal coordinate that the sprite is expected to be at on the next frame based on its current position and velocity, rounded toward zero to yield an integer pixel coordinate.
Public propertyProposedPixelY
The vertical coordinate that the sprite is expected to be at on the next frame based on its current position and velocity, rounded toward zero to yield an integer pixel coordinate.
Public propertySolidHeight
How many pixels high is the solid area of this sprite.
Public propertySolidWidth
How many pixels wide is the solid area of this sprite.
Top
See Also