Sprites
Functions
Call For All Sprites
Call For All Sprites
Call the supplied function for all sprites in the current pack.
Parameters:
Name | Type | Description |
---|---|---|
fn | Sprite Float Function | The sprite function to call on all sprites. |
val | Float | The value passed to the function for each sprite. |
Signatures:
void call_for_all_sprites(sprite_float_function *fn, float val)
public static void SplashKit.CallForAllSprites(SpriteFloatFunction fn, float val);
def call_for_all_sprites_with_value(fn, val):
procedure CallForAllSprites(fn: SpriteFloatFunction; val: Single)
Call For All Sprites
Call the supplied function for all sprites in the current pack.
Parameters:
Name | Type | Description |
---|---|---|
fn | Sprite Function | The sprite function to call on all sprites. |
Signatures:
void call_for_all_sprites(sprite_function *fn)
public static void SplashKit.CallForAllSprites(SpriteFunction fn);
def call_for_all_sprites(fn):
procedure CallForAllSprites(fn: SpriteFunction)
Call On Sprite Event
Register a procedure to be called when an events occur on any sprite.
Parameters:
Name | Type | Description |
---|---|---|
handler | Sprite Event Handler | The function to call when any sprite raises an event |
Signatures:
void call_on_sprite_event(sprite_event_handler *handler)
public static void SplashKit.CallOnSpriteEvent(SpriteEventHandler handler);
def call_on_sprite_event(handler):
procedure CallOnSpriteEvent(handler: SpriteEventHandler)
Create Sprite
Create Sprite
Creates a sprite for the passed in bitmap image. The sprite will use the cell information within the bitmap if it is animated at a later stage. This version of create_sprite will initialise the sprite to use pixel level collisions, no animations, and have one layer named ‘layer1’. This version of the constructor will assign a default name to the sprite for resource management purposes.
Parameters:
Name | Type | Description |
---|---|---|
layer | Bitmap | The bitmap for the sprite’s image. |
Return Type: Sprite
Signatures:
sprite create_sprite(bitmap layer)
public static Sprite SplashKit.CreateSprite(Bitmap layer);public Sprite(Bitmap layer);
def create_sprite(layer):
function CreateSprite(layer: Bitmap): Sprite
Usage:
Create Sprite
Creates a sprite for the passed in bitmap image. The sprite will use the cell information within the bitmap if it is animated at a later stage. This version of Create Sprite
will initialise the sprite to use pixel level collisions, the specified animation template, the layer have name ‘layer1’. This version of the constructor will assign a default name to the sprite for resource management purposes.
Parameters:
Name | Type | Description |
---|---|---|
layer | Bitmap | The bitmap for the sprite’s image. |
ani | Animation Script | The animation script for the sprite’s animations. |
Return Type: Sprite
Signatures:
sprite create_sprite(bitmap layer, animation_script ani)
public static Sprite SplashKit.CreateSprite(Bitmap layer, AnimationScript ani);public Sprite(Bitmap layer, AnimationScript ani);
def create_sprite_with_animation(layer, ani):
function CreateSprite(layer: Bitmap; ani: AnimationScript): Sprite
Create Sprite
Creates a sprite for the passed in bitmap image. The sprite will use the cell information within the bitmap if it is animated at a later stage. This version of create_sprite will initialise the sprite to use pixel level collisions, no animations, and have one layer named ‘layer1’. This version of the constructor will assign a default name to the sprite for resource management purposes.
Parameters:
Name | Type | Description |
---|---|---|
bitmap_name | String | The name of the bitmap to use as the sprite’s layer |
Return Type: Sprite
Signatures:
sprite create_sprite(const string &bitmap_name)
public static Sprite SplashKit.CreateSprite(string bitmapName);public Sprite(string bitmapName);
def create_sprite_with_bitmap_named(bitmap_name):
function CreateSprite(const bitmapName: String): Sprite
Create Sprite
Creates a sprite for the passed in bitmap image. The sprite will use the cell information within the sprite if it is animated at a later stage. This version of create_sprite will initialise the sprite to use pixel level collisions, no animation, the layer have name ‘layer1’.
Parameters:
Name | Type | Description |
---|---|---|
name | String | The name of the sprite for resource management. |
layer | Bitmap | The bitmap for the sprite’s image. |
Return Type: Sprite
Signatures:
sprite create_sprite(const string &name, bitmap layer)
public static Sprite SplashKit.CreateSprite(string name, Bitmap layer);public Sprite(string name, Bitmap layer);
def create_sprite_named(name, layer):
function CreateSprite(const name: String; layer: Bitmap): Sprite
Create Sprite
Creates a sprite for the passed in bitmap image. The sprite will use the cell information within the sprite if it is animated at a later stage. This version of create_sprite will initialise the sprite to use pixel level collisions, the specified animation template, the layer have name ‘layer1’.
Parameters:
Name | Type | Description |
---|---|---|
name | String | The name of the sprite for resource management. |
layer | Bitmap | The bitmap for the sprite’s image. |
ani | Animation Script | The animation script for the sprite’s animations. |
Return Type: Sprite
Signatures:
sprite create_sprite(const string &name, bitmap layer, animation_script ani)
public static Sprite SplashKit.CreateSprite(string name, Bitmap layer, AnimationScript ani);public Sprite(string name, Bitmap layer, AnimationScript ani);
def create_sprite_named_with_animation(name, layer, ani):
function CreateSprite(const name: String; layer: Bitmap; ani: AnimationScript): Sprite
Create Sprite
Creates a sprite. The bitmap_name is used to indicate the bitmap the sprite will use, and the animation_name is used to indicate which animation_script to use.
Parameters:
Name | Type | Description |
---|---|---|
bitmap_name | String | The name of the bitmap to use as the sprite’s image. |
animation_name | String | The name of the animation script to use for this sprite. |
Return Type: Sprite
Signatures:
sprite create_sprite(const string &bitmap_name, const string &animation_name)
public static Sprite SplashKit.CreateSprite(string bitmapName, string animationName);public Sprite(string bitmapName, string animationName);
def create_sprite_with_bitmap_and_animation_named(bitmap_name, animation_name):
function CreateSprite(const bitmapName: String; const animationName: String): Sprite
Create Sprite Pack
Create a new sprite_pack with a given name. This pack can then be selected and used to control which sprites are drawn/updated in the calls to draw_all_sprites and update_all_sprites.
Parameters:
Name | Type | Description |
---|---|---|
name | String | The name of the new sprite pack. |
Signatures:
void create_sprite_pack(const string &name)
public static void SplashKit.CreateSpritePack(string name);
def create_sprite_pack(name):
procedure CreateSpritePack(const name: String)
Current Sprite Pack
Returns the name of the currently selected sprite_pack.
Return Type: String
Signatures:
string current_sprite_pack()
public static string SplashKit.CurrentSpritePack();
def current_sprite_pack():
function CurrentSpritePack(): String
Draw All Sprites
draws all of the sprites in the current sprite pack. Packs can be switched to select between different sets of sprites.
Signatures:
void draw_all_sprites()
public static void SplashKit.DrawAllSprites();
def draw_all_sprites():
procedure DrawAllSprites()
Draw Sprite
Draw Sprite
Draws the sprite at its position in the game offset by a given amount. Only use this method when you want to draw the sprite displaced from its location in your game. Otherwise you should change the sprite’s location and then use the standard ”draw_sprite” routine.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to draw. |
offset | Vector 2d | The amount to offset the sprite. |
Signatures:
void draw_sprite(sprite s, const vector_2d &offset)
public void Sprite.Draw(Vector2D offset);public static void SplashKit.DrawSprite(Sprite s, Vector2D offset);
def draw_sprite_offset_by(s, offset):
procedure DrawSprite(s: Sprite; const offset: Vector2D)
Draw Sprite
Draws the sprite at its location in the world. This is affected by the position of the camera and the sprites current location. This is the standard routine for drawing sprites to the screen and should be used in most cases.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to draw. |
Signatures:
void draw_sprite(sprite s)
public void Sprite.Draw();public static void SplashKit.DrawSprite(Sprite s);
def draw_sprite(s):
procedure DrawSprite(s: Sprite)
Usage:
Draw Sprite
Draws the sprite at its position in the game offset by a given amount. Only use this method when you want to draw the sprite displaced from its location in your game. Otherwise you should change the sprite’s location and then use the standard Draw Sprite
routine.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to draw. |
x_offset | Double | The amount to offset on the x axis. |
y_offset | Double | The amount to offset on the y axis. |
Signatures:
void draw_sprite(sprite s, double x_offset, double y_offset)
public void Sprite.Draw(double xOffset, double yOffset);public static void SplashKit.DrawSprite(Sprite s, double xOffset, double yOffset);
def draw_sprite_offset_x_y(s, x_offset, y_offset):
procedure DrawSprite(s: Sprite; xOffset: Double; yOffset: Double)
Free All Sprites
Releases all of the sprites that have been loaded.
Signatures:
void free_all_sprites()
public static void SplashKit.FreeAllSprites();
def free_all_sprites():
procedure FreeAllSprites()
Free Sprite
Free the resources associated with a sprite.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to be destroyed. |
Signatures:
void free_sprite(sprite s)
public static void SplashKit.FreeSprite(Sprite s);
def free_sprite(s):
procedure FreeSprite(s: Sprite)
Usage:
Free Sprite Pack
Frees the sprite pack and all of its sprites.
Parameters:
Name | Type | Description |
---|---|---|
name | String | The name of the sprite pack to destroy. |
Signatures:
void free_sprite_pack(const string &name)
public static void SplashKit.FreeSpritePack(string name);
def free_sprite_pack(name):
procedure FreeSpritePack(const name: String)
Has Sprite
Determines if SplashKit has a sprite for the supplied name. This checks against all sprites, those loaded without a name are assigned a default.
Parameters:
Name | Type | Description |
---|---|---|
name | String | The name of the sprite to locate. |
Return Type: Boolean
Signatures:
bool has_sprite(const string &name)
public static bool SplashKit.HasSprite(string name);
def has_sprite(name):
function HasSprite(const name: String): Boolean
Has Sprite Pack
Indicates if a given sprite_pack has already been created.
Parameters:
Name | Type | Description |
---|---|---|
name | String | The name for the sprite pack. |
Return Type: Boolean
Signatures:
bool has_sprite_pack(const string &name)
public static bool SplashKit.HasSpritePack(string name);
def has_sprite_pack(name):
function HasSpritePack(const name: String): Boolean
Move Sprite
Move Sprite
moves the sprite as indicated by its velocity. You can call this directly ot alternatively, this action is performed when the sprite is updated using the ”update_sprite” routine.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to move. |
Signatures:
void move_sprite(sprite s)
public void Sprite.Move();public static void SplashKit.MoveSprite(Sprite s);
def move_sprite(s):
procedure MoveSprite(s: Sprite)
Move Sprite
Moves the sprite a given distance based on the value passed in rather than based on the sprite’s velocity. Typically this method is used to apply other movement actions to the sprite and the velocity of the sprite is used the intended movement of the sprite.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to move. |
distance | Vector 2d | The vector that represents the direction and distance to move the sprite. |
Signatures:
void move_sprite(sprite s, const vector_2d &distance)
public void Sprite.Move(Vector2D distance);public static void SplashKit.MoveSprite(Sprite s, Vector2D distance);
def move_sprite_by_vector(s, distance):
procedure MoveSprite(s: Sprite; const distance: Vector2D)
Move Sprite
Moves the sprite a percentage of a given distance based on the value passed in rather than based on the sprite’s velocity. Typically this method is used to apply other movement actions to the sprite and the velocity of the sprite is used the intended movement of the sprite.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to move. |
distance | Vector 2d | The vector that represents the direction and distance to move the sprite. |
pct | Float | The percentage of the distance to move the sprite. |
Signatures:
void move_sprite(sprite s, const vector_2d &distance, float pct)
public void Sprite.Move(Vector2D distance, float pct);public static void SplashKit.MoveSprite(Sprite s, Vector2D distance, float pct);
def move_sprite_by_vector_percent(s, distance, pct):
procedure MoveSprite(s: Sprite; const distance: Vector2D; pct: Single)
Move Sprite
Moves the sprite as indicated by a percentage of its velocity. You can call this directly ot alternatively, this action is performed when the sprite is updated using the ”update_sprite” routines that require a percentage.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to move. |
pct | Float | The percentage of the sprite’s velocity to move. |
Signatures:
void move_sprite(sprite s, float pct)
public void Sprite.Move(float pct);public static void SplashKit.MoveSprite(Sprite s, float pct);
def move_sprite_percent(s, pct):
procedure MoveSprite(s: Sprite; pct: Single)
Move Sprite To
This method moves a sprite to a given position in the game.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to move. |
x | Double | The sprite’s new x location. |
y | Double | The sprite’s new y location. |
Signatures:
void move_sprite_to(sprite s, double x, double y)
public void Sprite.MoveTo(double x, double y);public static void SplashKit.MoveSpriteTo(Sprite s, double x, double y);
def move_sprite_to(s, x, y):
procedure MoveSpriteTo(s: Sprite; x: Double; y: Double)
Select Sprite Pack
Selects the named sprite_pack (if it has been created). The selected sprite_pack determines which sprites are drawn and updated with the draw_all_sprites and update_all_sprites code.
Parameters:
Name | Type | Description |
---|---|---|
name | String | The name of the sprite pack to select. |
Signatures:
void select_sprite_pack(const string &name)
public static void SplashKit.SelectSpritePack(string name);
def select_sprite_pack(name):
procedure SelectSpritePack(const name: String)
Sprite Add Layer
Adds a new layer to the sprite.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to add the layer to. |
new_layer | Bitmap | The new layer’s bitmap. |
layer_name | String | The name of the new layer. |
Return Type: Integer
Signatures:
int sprite_add_layer(sprite s, bitmap new_layer, const string &layer_name)
public int Sprite.AddLayer(Bitmap newLayer, string layerName);public static int SplashKit.SpriteAddLayer(Sprite s, Bitmap newLayer, string layerName);
def sprite_add_layer(s, new_layer, layer_name):
function SpriteAddLayer(s: Sprite; newLayer: Bitmap; const layerName: String): Integer
Sprite Add To Velocity
Alters the current velocity of the sprite, adding the passed in vector_2d to the current velocity. When the sprite is updated (see Update Sprite
) this vector_2d is used to move the sprite.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to change. |
value | Vector 2d | The amount to add to the sprite’s velocity. |
Signatures:
void sprite_add_to_velocity(sprite s, const vector_2d &value)
public void Sprite.AddToVelocity(Vector2D value);public static void SplashKit.SpriteAddToVelocity(Sprite s, Vector2D value);
def sprite_add_to_velocity(s, value):
procedure SpriteAddToVelocity(s: Sprite; const value: Vector2D)
Sprite Add Value
Sprite Add Value
Adds a new kind of value to the sprite
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to change. |
name | String | The name of the new value to store in the sprite. |
Signatures:
void sprite_add_value(sprite s, const string &name)
public void Sprite.AddValue(string name);public static void SplashKit.SpriteAddValue(Sprite s, string name);
def sprite_add_value(s, name):
procedure SpriteAddValue(s: Sprite; const name: String)
Sprite Add Value
Adds a new kind of value to the sprite, setting the initial value to the value passed in.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to change. |
name | String | The name of the new value to store in the sprite. |
init_val | Float | The initial value. |
Signatures:
void sprite_add_value(sprite s, const string &name, float init_val)
public void Sprite.AddValue(string name, float initVal);public static void SplashKit.SpriteAddValue(Sprite s, string name, float initVal);
def sprite_add_value_with_default(s, name, init_val):
procedure SpriteAddValue(s: Sprite; const name: String; initVal: Single)
Sprite Anchor Point
Returns the anchor point of the sprite. This is the point around which the sprite rotates. This is in sprite coordinates, so as if the sprite is drawn at 0,0.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to get the details from. |
Return Type: Point 2d
Signatures:
point_2d sprite_anchor_point(sprite s)
public Point2D Sprite.AnchorPoint { get }public static Point2D SplashKit.SpriteAnchorPoint(Sprite s);
def sprite_anchor_point(s):
function SpriteAnchorPoint(s: Sprite): Point2D
Sprite Anchor Position
The sprite anchor position, is the location of the anchor point in world coordinates, based upon the position of the sprite.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to find where the anchor is in world coordinates |
Return Type: Point 2d
Signatures:
point_2d sprite_anchor_position(sprite s)
public static Point2D SplashKit.SpriteAnchorPosition(Sprite s);
def sprite_anchor_position(s):
function SpriteAnchorPosition(s: Sprite): Point2D
Sprite Animation Has Ended
Indicates if the sprites animation has ended.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to get the details from. |
Return Type: Boolean
Signatures:
bool sprite_animation_has_ended(sprite s)
public bool Sprite.AnimationHasEnded { get }public static bool SplashKit.SpriteAnimationHasEnded(Sprite s);
def sprite_animation_has_ended(s):
function SpriteAnimationHasEnded(s: Sprite): Boolean
Sprite Animation Name
Returns the name of the sprite’s current animation.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to get the details from. |
Return Type: String
Signatures:
string sprite_animation_name(sprite s)
public string Sprite.AnimationName();public static string SplashKit.SpriteAnimationName(Sprite s);
def sprite_animation_name(s):
function SpriteAnimationName(s: Sprite): String
Sprite At
Determines if a sprite is at a given point.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to test |
pt | Point 2d | The point to check (in world coordinates) |
Return Type: Boolean
Signatures:
bool sprite_at(sprite s, const point_2d &pt)
public static bool SplashKit.SpriteAt(Sprite s, Point2D pt);
def sprite_at(s, pt):
function SpriteAt(s: Sprite; const pt: Point2D): Boolean
Sprite Bring Layer Forward
Sends the layer specified forward in the visible layer order.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to change |
visible_layer | Integer | The visible layer to bring forward |
Signatures:
void sprite_bring_layer_forward(sprite s, int visible_layer)
public void Sprite.SendLayerForward(int visibleLayer);public static void SplashKit.SpriteBringLayerForward(Sprite s, int visibleLayer);
def sprite_bring_layer_forward(s, visible_layer):
procedure SpriteBringLayerForward(s: Sprite; visibleLayer: Integer)
Sprite Bring Layer To Front
Sends the layer specified to the front in the visible layer order.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to change |
visible_layer | Integer | The visible layer to bring to the front |
Signatures:
void sprite_bring_layer_to_front(sprite s, int visible_layer)
public void Sprite.SendLayerTofront(int visibleLayer);public static void SplashKit.SpriteBringLayerToFront(Sprite s, int visibleLayer);
def sprite_bring_layer_to_front(s, visible_layer):
procedure SpriteBringLayerToFront(s: Sprite; visibleLayer: Integer)
Sprite Call On Event
Register a procedure to call when events occur on the sprite.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to add the handler to. |
handler | Sprite Event Handler | The function to call when this sprite raises an event. |
Signatures:
void sprite_call_on_event(sprite s, sprite_event_handler *handler)
public void Sprite.CallOnEvent(SpriteEventHandler handler);public static void SplashKit.SpriteCallOnEvent(Sprite s, SpriteEventHandler handler);
def sprite_call_on_event(s, handler):
procedure SpriteCallOnEvent(s: Sprite; handler: SpriteEventHandler)
Sprite Center Point
Returns the center point of the passed in sprite. This is based on the sprite’s Position, Width and Height.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to get the details from. |
Return Type: Point 2d
Signatures:
point_2d sprite_center_point(sprite s)
public Point2D Sprite.SpriteCenterPoint { get }public static Point2D SplashKit.SpriteCenterPoint(Sprite s);
def sprite_center_point(s):
function SpriteCenterPoint(s: Sprite): Point2D
Sprite Circle
Gets a circle in the bounds of the base layer of the indicated sprite.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to get the details from. |
Return Type: Circle
Signatures:
circle sprite_circle(sprite s)
public Circle Sprite.Circle();public static Circle SplashKit.SpriteCircle(Sprite s);
def sprite_circle(s):
function SpriteCircle(s: Sprite): Circle
Sprite Collision Bitmap
Returns the bitmap used by the sprite to determine if it has collided with other objects in the game.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to get the details from. |
Return Type: Bitmap
Signatures:
bitmap sprite_collision_bitmap(sprite s)
public Bitmap Sprite.CollisionBitmap { get }public static Bitmap SplashKit.SpriteCollisionBitmap(Sprite s);
def sprite_collision_bitmap(s):
function SpriteCollisionBitmap(s: Sprite): Bitmap
Sprite Collision Circle
Gets a circle in the bounds of the indicated sprite’s collision rectangle.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to get the details from. |
Return Type: Circle
Signatures:
circle sprite_collision_circle(sprite s)
public Circle Sprite.CollisionCircle();public static Circle SplashKit.SpriteCollisionCircle(Sprite s);
def sprite_collision_circle(s):
function SpriteCollisionCircle(s: Sprite): Circle
Sprite Collision Kind
Returns the kind of collision used with this sprite. This is used when determining if the sprite has collided with other objects in the game.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to get the details from. |
Return Type: Collision Test Kind
Signatures:
collision_test_kind sprite_collision_kind(sprite s)
public CollisionTestKind Sprite.CollisionKind { get }public static CollisionTestKind SplashKit.SpriteCollisionKind(Sprite s);
def sprite_collision_kind(s):
function SpriteCollisionKind(s: Sprite): CollisionTestKind
Sprite Collision Rectangle
Returns the collision rectangle for the specified sprite.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to get the details from. |
Return Type: Rectangle
Signatures:
rectangle sprite_collision_rectangle(sprite s)
public Rectangle Sprite.CollisionRectangle { get }public static Rectangle SplashKit.SpriteCollisionRectangle(Sprite s);
def sprite_collision_rectangle(s):
function SpriteCollisionRectangle(s: Sprite): Rectangle
Sprite Current Cell
Returns the current animation cell for an animated sprite. The cell is updated when the sprite’s animation data is updated.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to get the details from. |
Return Type: Integer
Signatures:
int sprite_current_cell(sprite s)
public int Sprite.CurrentCell { get }public static int SplashKit.SpriteCurrentCell(Sprite s);
def sprite_current_cell(s):
function SpriteCurrentCell(s: Sprite): Integer
Sprite Current Cell Rectangle
Returns a rectangle of the current cell within the sprite’s image. This is used to determine what part of the bitmap should be used when the sprite is drawn.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to get the details from. |
Return Type: Rectangle
Signatures:
rectangle sprite_current_cell_rectangle(sprite s)
public Rectangle Sprite.CurrentCellRectangle { get }public static Rectangle SplashKit.SpriteCurrentCellRectangle(Sprite s);
def sprite_current_cell_rectangle(s):
function SpriteCurrentCellRectangle(s: Sprite): Rectangle
Sprite Dx
Returns the X value of the sprite’s velocity.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to get the details from. |
Return Type: Float
Signatures:
float sprite_dx(sprite s)
public float Sprite.Dx { get }public static float SplashKit.SpriteDx(Sprite s);
def sprite_dx(s):
function SpriteDx(s: Sprite): Single
Sprite Dy
Returns the Y value of the sprite’s velocity.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to get the details from. |
Return Type: Float
Signatures:
float sprite_dy(sprite s)
public float Sprite.Dy { get }public static float SplashKit.SpriteDy(Sprite s);
def sprite_dy(s):
function SpriteDy(s: Sprite): Single
Sprite Has Value
Indicates if the sprite has a value with the given name.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to get the details from. |
name | String | The name of the value to check. |
Return Type: Boolean
Signatures:
bool sprite_has_value(sprite s, string name)
public static bool SplashKit.SpriteHasValue(Sprite s, string name);
def sprite_has_value(s, name):
function SpriteHasValue(s: Sprite; name: String): Boolean
Sprite Heading
Returns the direction the sprite is heading in degrees.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to get the details from. |
Return Type: Float
Signatures:
float sprite_heading(sprite s)
public float Sprite.Heading { get }public static float SplashKit.SpriteHeading(Sprite s);
def sprite_heading(s):
function SpriteHeading(s: Sprite): Single
Sprite Height
The current height of the sprite (aligned to the Y axis).
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to get the details from. |
Return Type: Integer
Signatures:
int sprite_height(sprite s)
public int Sprite.Height { get }public static int SplashKit.SpriteHeight(Sprite s);
def sprite_height(s):
function SpriteHeight(s: Sprite): Integer
Sprite Hide Layer
Sprite Hide Layer
Hide the specified layer of the sprite.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to hide the layer of. |
name | String | The name of the layer to hide. |
Signatures:
void sprite_hide_layer(sprite s, const string &name)
public void Sprite.HideLayer(string name);public static void SplashKit.SpriteHideLayer(Sprite s, string name);
def sprite_hide_layer_named(s, name):
procedure SpriteHideLayer(s: Sprite; const name: String)
Sprite Hide Layer
Hide the specified layer of the sprite.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to hide the layer of. |
id | Integer | The index of the layer to hide. |
Signatures:
void sprite_hide_layer(sprite s, int id)
public void Sprite.HideLayer(int id);public static void SplashKit.SpriteHideLayer(Sprite s, int id);
def sprite_hide_layer(s, id):
procedure SpriteHideLayer(s: Sprite; id: Integer)
Sprite Layer
Sprite Layer
Returns the bitmap of the indicated layer of the sprite.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to get the layer from |
name | String | The name of the layer to fetch |
Return Type: Bitmap
Signatures:
bitmap sprite_layer(sprite s, const string &name)
public Bitmap Sprite.Layer(string name);public static Bitmap SplashKit.SpriteLayer(Sprite s, string name);
def sprite_layer_named(s, name):
function SpriteLayer(s: Sprite; const name: String): Bitmap
Sprite Layer
Returns the bitmap of the indicated layer of the sprite.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to get the layer from |
idx | Integer | The index of the layer |
Return Type: Bitmap
Signatures:
bitmap sprite_layer(sprite s, int idx)
public Bitmap Sprite.Layer(int idx);public static Bitmap SplashKit.SpriteLayer(Sprite s, int idx);
def sprite_layer_at_index(s, idx):
function SpriteLayer(s: Sprite; idx: Integer): Bitmap
Sprite Layer Circle
Sprite Layer Circle
Gets a circle in the bounds of the indicated layer.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to get the details from. |
name | String | The name of the layer. |
Return Type: Circle
Signatures:
circle sprite_layer_circle(sprite s, const string &name)
public Circle Sprite.LayerCircle(string name);public static Circle SplashKit.SpriteLayerCircle(Sprite s, string name);
def sprite_layer_circle_named(s, name):
function SpriteLayerCircle(s: Sprite; const name: String): Circle
Sprite Layer Circle
Gets a circle in the bounds of the indicated layer.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to get the details from. |
idx | Integer | The index of the layer. |
Return Type: Circle
Signatures:
circle sprite_layer_circle(sprite s, int idx)
public Circle Sprite.LayerCircle(int idx);public static Circle SplashKit.SpriteLayerCircle(Sprite s, int idx);
def sprite_layer_circle_at_index(s, idx):
function SpriteLayerCircle(s: Sprite; idx: Integer): Circle
Sprite Layer Count
Returns the number of layers within the sprite.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to get the layer count from. |
Return Type: Integer
Signatures:
int sprite_layer_count(sprite s)
public int Sprite.LayerCount { get }public static int SplashKit.SpriteLayerCount(Sprite s);
def sprite_layer_count(s):
function SpriteLayerCount(s: Sprite): Integer
Sprite Layer Height
Sprite Layer Height
The height of a given layer of the sprite (aligned to the Y axis).
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to get the details from. |
name | String | The name of the layer to get the details of. |
Return Type: Integer
Signatures:
int sprite_layer_height(sprite s, const string &name)
public int Sprite.LayerHeight(string name);public static int SplashKit.SpriteLayerHeight(Sprite s, string name);
def sprite_layer_height_named(s, name):
function SpriteLayerHeight(s: Sprite; const name: String): Integer
Sprite Layer Height
The height of a given layer of the sprite (aligned to the Y axis).
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to get the details from. |
idx | Integer | The index of the layer to get the details of. |
Return Type: Integer
Signatures:
int sprite_layer_height(sprite s, int idx)
public int Sprite.LayerHeight(int idx);public static int SplashKit.SpriteLayerHeight(Sprite s, int idx);
def sprite_layer_height(s, idx):
function SpriteLayerHeight(s: Sprite; idx: Integer): Integer
Sprite Layer Index
Returns the index of the specified layer.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to get the layer from |
name | String | The name of the layer to get the index of |
Return Type: Integer
Signatures:
int sprite_layer_index(sprite s, const string &name)
public int Sprite.IndexOfLayer(string name);public static int SplashKit.SpriteLayerIndex(Sprite s, string name);
def sprite_layer_index(s, name):
function SpriteLayerIndex(s: Sprite; const name: String): Integer
Sprite Layer Name
Returns the name of the specified layer.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to get the layer name from |
idx | Integer | The index of the layer you want the name of |
Return Type: String
Signatures:
string sprite_layer_name(sprite s, int idx)
public string Sprite.LayerName(int idx);public static string SplashKit.SpriteLayerName(Sprite s, int idx);
def sprite_layer_name(s, idx):
function SpriteLayerName(s: Sprite; idx: Integer): String
Sprite Layer Offset
Sprite Layer Offset
Gets the offset of the specified layer.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to get the details from. |
name | String | The name of the layer to get the offset of. |
Return Type: Vector 2d
Signatures:
vector_2d sprite_layer_offset(sprite s, const string &name)
public Vector2D Sprite.LayerOffset(string name);public static Vector2D SplashKit.SpriteLayerOffset(Sprite s, string name);
def sprite_layer_offset_named(s, name):
function SpriteLayerOffset(s: Sprite; const name: String): Vector2D
Sprite Layer Offset
Gets the offset of the specified layer.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to get the details from. |
idx | Integer | The index of the layer to get the offset of. |
Return Type: Vector 2d
Signatures:
vector_2d sprite_layer_offset(sprite s, int idx)
public Vector2D Sprite.LayerOffset(int idx);public static Vector2D SplashKit.SpriteLayerOffset(Sprite s, int idx);
def sprite_layer_offset(s, idx):
function SpriteLayerOffset(s: Sprite; idx: Integer): Vector2D
Sprite Layer Rectangle
Sprite Layer Rectangle
Gets a rectangle that surrounds the indicated layer.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to get the details from. |
name | String | The name of the layer. |
Return Type: Rectangle
Signatures:
rectangle sprite_layer_rectangle(sprite s, const string &name)
public Rectangle Sprite.LayerRectangle(string name);public static Rectangle SplashKit.SpriteLayerRectangle(Sprite s, string name);
def sprite_layer_rectangle_named(s, name):
function SpriteLayerRectangle(s: Sprite; const name: String): Rectangle
Sprite Layer Rectangle
Gets a rectangle that surrounds the indicated layer.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to get the details from. |
idx | Integer | The index of the layer. |
Return Type: Rectangle
Signatures:
rectangle sprite_layer_rectangle(sprite s, int idx)
public Rectangle Sprite.LayerRectangle(int idx);public static Rectangle SplashKit.SpriteLayerRectangle(Sprite s, int idx);
def sprite_layer_rectangle_at_index(s, idx):
function SpriteLayerRectangle(s: Sprite; idx: Integer): Rectangle
Sprite Layer Width
Sprite Layer Width
The width of a given layer of the sprite (aligned to the X axis).
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to get the details from. |
name | String | The name of the layer to get the details of. |
Return Type: Integer
Signatures:
int sprite_layer_width(sprite s, const string &name)
public int Sprite.LayerWidth(string name);public static int SplashKit.SpriteLayerWidth(Sprite s, string name);
def sprite_layer_width_named(s, name):
function SpriteLayerWidth(s: Sprite; const name: String): Integer
Sprite Layer Width
The width of a given layer of the sprite (aligned to the X axis).
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to get the details from. |
idx | Integer | The index of the layer to get the details of. |
Return Type: Integer
Signatures:
int sprite_layer_width(sprite s, int idx)
public int Sprite.LayerWidth(int idx);public static int SplashKit.SpriteLayerWidth(Sprite s, int idx);
def sprite_layer_width(s, idx):
function SpriteLayerWidth(s: Sprite; idx: Integer): Integer
Sprite Location Matrix
Returns a matrix that can be used to transform points into the coordinate space of the passed in sprite.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to get the details from. |
Return Type: Matrix 2d
Signatures:
matrix_2d sprite_location_matrix(sprite s)
public Matrix2D Sprite.LocationMatrix { get }public static Matrix2D SplashKit.SpriteLocationMatrix(Sprite s);
def sprite_location_matrix(s):
function SpriteLocationMatrix(s: Sprite): Matrix2D
Sprite Mass
This indicates the mass of the sprite for any of the collide methods from Physics. The mass of two colliding sprites will determine the relative velocitys after the collision.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to get the details from. |
Return Type: Float
Signatures:
float sprite_mass(sprite s)
public float Sprite.Mass { get }public static float SplashKit.SpriteMass(Sprite s);
def sprite_mass(s):
function SpriteMass(s: Sprite): Single
Sprite Move From Anchor Point
Indicates if the sprite is moved from its anchor point, or from its top left. When this returns true the location of the sprite will indicate its anchor point. When this returns false the location of the sprite is its top left corner.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to get the details of. |
Return Type: Boolean
Signatures:
bool sprite_move_from_anchor_point(sprite s)
public bool Sprite.MoveFromAnchorPoint { get }public static bool SplashKit.SpriteMoveFromAnchorPoint(Sprite s);
def sprite_move_from_anchor_point(s):
function SpriteMoveFromAnchorPoint(s: Sprite): Boolean
Sprite Move To
This void starts the sprite moving to the indicated destination point, over a specified number of seconds. When the sprite arrives it will raise the sprite_arrived event.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to move. |
pt | Point 2d | The sprite’s destination. |
taking_seconds | Float | The time the sprite should take to get to pt. |
Signatures:
void sprite_move_to(sprite s, const point_2d &pt, float taking_seconds)
public void Sprite.MoveTo(Point2D pt, float takingSeconds);public static void SplashKit.SpriteMoveTo(Sprite s, Point2D pt, float takingSeconds);
def sprite_move_to_taking_seconds(s, pt, taking_seconds):
procedure SpriteMoveTo(s: Sprite; const pt: Point2D; takingSeconds: Single)
Sprite Name
Returns the name of the sprite. This name is used for resource management and can be used to interact with the sprite in various routines.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to get the details from. |
Return Type: String
Signatures:
string sprite_name(sprite s)
public string Sprite.Name { get }public static string SplashKit.SpriteName(Sprite s);
def sprite_name(s):
function SpriteName(s: Sprite): String
Sprite Named
Returns the Sprite
with the specified name.
Parameters:
Name | Type | Description |
---|---|---|
name | String | The name of the sprite to locate. |
Return Type: Sprite
Signatures:
sprite sprite_named(const string &name)
public static Sprite SplashKit.SpriteNamed(string name);
def sprite_named(name):
function SpriteNamed(const name: String): Sprite
Sprite Offscreen
Returns true if the sprite is entirely off the current screen.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to test. |
Return Type: Boolean
Signatures:
bool sprite_offscreen(sprite s)
public bool Sprite.Offscreen();public static bool SplashKit.SpriteOffscreen(Sprite s);
def sprite_offscreen(s):
function SpriteOffscreen(s: Sprite): Boolean
Sprite On Screen At
Sprite On Screen At
Returns true if a pixel of the Sprite
s
is at the screen location specified (pt
), which is converted to a world location.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to test. |
pt | Point 2d | The location in screen coordinates to check. |
Return Type: Boolean
Signatures:
bool sprite_on_screen_at(sprite s, const point_2d &pt)
public bool Sprite.OnScreenAt(Point2D pt);public static bool SplashKit.SpriteOnScreenAt(Sprite s, Point2D pt);
def sprite_on_screen_at_point(s, pt):
function SpriteOnScreenAt(s: Sprite; const pt: Point2D): Boolean
Sprite On Screen At
Returns true if a pixel of the Sprite
s
is at the screen location specified.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to test. |
x | Double | The x location in screen coordinates to check. |
y | Double | The y location in screen coordinates to check. |
Return Type: Boolean
Signatures:
bool sprite_on_screen_at(sprite s, double x, double y)
public bool Sprite.OnScreenAt(double x, double y);public static bool SplashKit.SpriteOnScreenAt(Sprite s, double x, double y);
def sprite_on_screen_at(s, x, y):
function SpriteOnScreenAt(s: Sprite; x: Double; y: Double): Boolean
Sprite Position
Returns the sprite’s position.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to get the details from. |
Return Type: Point 2d
Signatures:
point_2d sprite_position(sprite s)
public Point2D Sprite.Position { get }public static Point2D SplashKit.SpritePosition(Sprite s);
def sprite_position(s):
function SpritePosition(s: Sprite): Point2D
Sprite Replay Animation
Sprite Replay Animation
Restart the sprite’s current animation, this will play a sound if the first cell of the animation is associated with a sound effect.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to replay the animation of. |
Signatures:
void sprite_replay_animation(sprite s)
public void Sprite.ReplayAnimation();public static void SplashKit.SpriteReplayAnimation(Sprite s);
def sprite_replay_animation(s):
procedure SpriteReplayAnimation(s: Sprite)
Sprite Replay Animation
Restart the sprite’s current animation, this will play a sound if with_sound is true and the first cell of the animation is associated with a sound effect.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to replay the animation of. |
with_sound | Boolean | If false, the animation will not play associated sound effects when restarted. |
Signatures:
void sprite_replay_animation(sprite s, bool with_sound)
public void Sprite.ReplayAnimation(bool withSound);public static void SplashKit.SpriteReplayAnimation(Sprite s, bool withSound);
def sprite_replay_animation_with_sound(s, with_sound):
procedure SpriteReplayAnimation(s: Sprite; withSound: Boolean)
Sprite Rotation
This indicates the angle of rotation of the sprite. This will rotate any images of the sprite before drawing, which can be very slow. avoid using this method with bitmap based sprites where possible.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to get the details from. |
Return Type: Float
Signatures:
float sprite_rotation(sprite s)
public float Sprite.Rotation { get }public static float SplashKit.SpriteRotation(Sprite s);
def sprite_rotation(s):
function SpriteRotation(s: Sprite): Single
Sprite Scale
This indicates the scale of the sprite. This will scale any images of the sprite before drawing, which can be very slow. avoid using this method with bitmap based sprites where possible.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to get the details from. |
Return Type: Float
Signatures:
float sprite_scale(sprite s)
public float Sprite.Scale { get }public static float SplashKit.SpriteScale(Sprite s);
def sprite_scale(s):
function SpriteScale(s: Sprite): Single
Sprite Screen Rectangle
Returns the rectangle representing the location of the sprite on the screen.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to get the details from. |
Return Type: Rectangle
Signatures:
rectangle sprite_screen_rectangle(sprite s)
public Rectangle Sprite.ScreenRectangle { get }public static Rectangle SplashKit.SpriteScreenRectangle(Sprite s);
def sprite_screen_rectangle(s):
function SpriteScreenRectangle(s: Sprite): Rectangle
Sprite Send Layer Backward
Sends the layer specified backward in the visible layer order.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to change |
visible_layer | Integer | The visible layer to send to backward |
Signatures:
void sprite_send_layer_backward(sprite s, int visible_layer)
public void Sprite.SendLayerTobackward(int visibleLayer);public static void SplashKit.SpriteSendLayerBackward(Sprite s, int visibleLayer);
def sprite_send_layer_backward(s, visible_layer):
procedure SpriteSendLayerBackward(s: Sprite; visibleLayer: Integer)
Sprite Send Layer To Back
Sends the layer specified to the back in the visible layer order.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to change |
visible_layer | Integer | The visible layer to send to back |
Signatures:
void sprite_send_layer_to_back(sprite s, int visible_layer)
public void Sprite.SendLayerToBack(int visibleLayer);public static void SplashKit.SpriteSendLayerToBack(Sprite s, int visibleLayer);
def sprite_send_layer_to_back(s, visible_layer):
procedure SpriteSendLayerToBack(s: Sprite; visibleLayer: Integer)
Sprite Set Anchor Point
Allows you to set the anchor point for the sprite. This is the point around which the sprite rotates. This is in sprite coordinates, as if the sprite is drawn at 0,0.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to change. |
pt | Point 2d | The new anchor point in sprite coordinates. |
Signatures:
void sprite_set_anchor_point(sprite s, const point_2d &pt)
public void Sprite.AnchorPoint { set }public static void SplashKit.SpriteSetAnchorPoint(Sprite s, Point2D pt);
def sprite_set_anchor_point(s, pt):
procedure SpriteSetAnchorPoint(s: Sprite; const pt: Point2D)
Sprite Set Collision Bitmap
Sets the bitmap used by the sprite to determine if it has collided with other objects in the game. By default the collision_bitmap is set to the bitmap from the sprite’s first layer.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to change. |
bmp | Bitmap | The new collision bitmap for the sprite. |
Signatures:
void sprite_set_collision_bitmap(sprite s, bitmap bmp)
public void Sprite.CollisionBitmap { set }public static void SplashKit.SpriteSetCollisionBitmap(Sprite s, Bitmap bmp);
def sprite_set_collision_bitmap(s, bmp):
procedure SpriteSetCollisionBitmap(s: Sprite; bmp: Bitmap)
Sprite Set Collision Kind
Sets the kind of collision used with this sprite. This is used when determining if the sprite has collided with other objects in the game.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to change. |
value | Collision Test Kind | The new kind of collision test for this sprite. |
Signatures:
void sprite_set_collision_kind(sprite s, collision_test_kind value)
public void Sprite.CollisionKind { set }public static void SplashKit.SpriteSetCollisionKind(Sprite s, CollisionTestKind value);
def sprite_set_collision_kind(s, value):
procedure SpriteSetCollisionKind(s: Sprite; value: CollisionTestKind)
Sprite Set Dx
Sets the X value of the sprite’s velocity.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to change. |
value | Float | The new x component of the sprite’s velocity. |
Signatures:
void sprite_set_dx(sprite s, float value)
public void Sprite.Dx { set }public static void SplashKit.SpriteSetDx(Sprite s, float value);
def sprite_set_dx(s, value):
procedure SpriteSetDx(s: Sprite; value: Single)
Sprite Set Dy
Sets the Y value of the sprite’s velocity.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to change. |
value | Float | The new y component of the sprite’s velocity. |
Signatures:
void sprite_set_dy(sprite s, float value)
public void Sprite.Dy { set }public static void SplashKit.SpriteSetDy(Sprite s, float value);
def sprite_set_dy(s, value):
procedure SpriteSetDy(s: Sprite; value: Single)
Sprite Set Heading
Alters the direction the sprite is heading without changing the speed.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to change. |
value | Float | The new angle for the sprite’s velocity — distance remains the same. |
Signatures:
void sprite_set_heading(sprite s, float value)
public void Sprite.Heading { set }public static void SplashKit.SpriteSetHeading(Sprite s, float value);
def sprite_set_heading(s, value):
procedure SpriteSetHeading(s: Sprite; value: Single)
Sprite Set Layer Offset
Sprite Set Layer Offset
Sets the offset of the specified layer. The offset is used when the layer is drawn in the sprite, and moves the image relative to the sprite.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to change. |
name | String | The name of the layer to change. |
value | Vector 2d | The new offset. |
Signatures:
void sprite_set_layer_offset(sprite s, const string &name, const vector_2d &value)
public void Sprite.SetLayerOffset(string name, Vector2D value);public static void SplashKit.SpriteSetLayerOffset(Sprite s, string name, Vector2D value);
def sprite_set_layer_offset_named(s, name, value):
procedure SpriteSetLayerOffset(s: Sprite; const name: String; const value: Vector2D)
Sprite Set Layer Offset
Sets the offset of the specified layer.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to change. |
idx | Integer | The index of the layer to change. |
value | Vector 2d | The new offset. |
Signatures:
void sprite_set_layer_offset(sprite s, int idx, const vector_2d &value)
public void Sprite.SetLayerOffset(int idx, Vector2D value);public static void SplashKit.SpriteSetLayerOffset(Sprite s, int idx, Vector2D value);
def sprite_set_layer_offset_at_index(s, idx, value):
procedure SpriteSetLayerOffset(s: Sprite; idx: Integer; const value: Vector2D)
Sprite Set Mass
Allows you to change the mass of a sprite.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to change. |
value | Float | The new mass for the sprite. |
Signatures:
void sprite_set_mass(sprite s, float value)
public void Sprite.Mass { set }public static void SplashKit.SpriteSetMass(Sprite s, float value);
def sprite_set_mass(s, value):
procedure SpriteSetMass(s: Sprite; value: Single)
Sprite Set Move From Anchor Point
Allows you to indicate if the sprite is moved from its anchor point, or from its top left. When set to true the location of the sprite will be its anchor point. When set to false the location of the sprite is its top left corner.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to change. |
value | Boolean | The value to set this option. |
Signatures:
void sprite_set_move_from_anchor_point(sprite s, bool value)
public void Sprite.MoveFromAnchorPoint { set }public static void SplashKit.SpriteSetMoveFromAnchorPoint(Sprite s, bool value);
def sprite_set_move_from_anchor_point(s, value):
procedure SpriteSetMoveFromAnchorPoint(s: Sprite; value: Boolean)
Sprite Set Position
Sets the sprite’s position.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to change. |
value | Point 2d | The new location for the sprite. |
Signatures:
void sprite_set_position(sprite s, const point_2d &value)
public void Sprite.Position { set }public static void SplashKit.SpriteSetPosition(Sprite s, Point2D value);
def sprite_set_position(s, value):
procedure SpriteSetPosition(s: Sprite; const value: Point2D)
Usage:
Sprite Set Rotation
Allows you to change the rotation of a sprite.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to change. |
value | Float | The new rotation angle for the sprite |
Signatures:
void sprite_set_rotation(sprite s, float value)
public void Sprite.Rotation { set }public static void SplashKit.SpriteSetRotation(Sprite s, float value);
def sprite_set_rotation(s, value):
procedure SpriteSetRotation(s: Sprite; value: Single)
Sprite Set Scale
Allows you to change the scale of a sprite.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to change. |
value | Float | The new scale for the sprite. |
Signatures:
void sprite_set_scale(sprite s, float value)
public void Sprite.Scale { set }public static void SplashKit.SpriteSetScale(Sprite s, float value);
def sprite_set_scale(s, value):
procedure SpriteSetScale(s: Sprite; value: Single)
Sprite Set Speed
Alters the speed of the sprite without effecting the direction.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to change. |
value | Float | The new speed of the sprite — direction will remain the same. |
Signatures:
void sprite_set_speed(sprite s, float value)
public void Sprite.Speed { set }public static void SplashKit.SpriteSetSpeed(Sprite s, float value);
def sprite_set_speed(s, value):
procedure SpriteSetSpeed(s: Sprite; value: Single)
Sprite Set Value
Assigns a value to the sprite.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to change. |
name | String | The name of the value to change |
val | Float | The new value. |
Signatures:
void sprite_set_value(sprite s, const string &name, float val)
public void Sprite.SetValue(string name, float val);public static void SplashKit.SpriteSetValue(Sprite s, string name, float val);
def sprite_set_value_named(s, name, val):
procedure SpriteSetValue(s: Sprite; const name: String; val: Single)
Sprite Set Velocity
Sets the current velocity of the sprite. When the sprite is updated (see Update Sprite
) this vector_2d is used to move the sprite.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to change. |
value | Vector 2d | The new sprite velocity. |
Signatures:
void sprite_set_velocity(sprite s, const vector_2d &value)
public void Sprite.Velocity { set }public static void SplashKit.SpriteSetVelocity(Sprite s, Vector2D value);
def sprite_set_velocity(s, value):
procedure SpriteSetVelocity(s: Sprite; const value: Vector2D)
Usage:
Sprite Set X
Sets the X position of the sprite.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to change. |
value | Float | The new x location. |
Signatures:
void sprite_set_x(sprite s, float value)
public void Sprite.X { set }public static void SplashKit.SpriteSetX(Sprite s, float value);
def sprite_set_x(s, value):
procedure SpriteSetX(s: Sprite; value: Single)
Usage:
Sprite Set Y
Sets the Y position of the sprite.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to change. |
value | Float | The new sprite y. |
Signatures:
void sprite_set_y(sprite s, float value)
public void Sprite.Y { set }public static void SplashKit.SpriteSetY(Sprite s, float value);
def sprite_set_y(s, value):
procedure SpriteSetY(s: Sprite; value: Single)
Usage:
Sprite Show Layer
Sprite Show Layer
Show the specified layer of the sprite.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to show the layer of. |
name | String | The layer to show. |
Return Type: Integer
Signatures:
int sprite_show_layer(sprite s, const string &name)
public int Sprite.ShowLayer(string name);public static int SplashKit.SpriteShowLayer(Sprite s, string name);
def sprite_show_layer_named(s, name):
function SpriteShowLayer(s: Sprite; const name: String): Integer
Sprite Show Layer
Show the specified layer of the sprite.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to show the layer of. |
id | Integer | The index to show. |
Return Type: Integer
Signatures:
int sprite_show_layer(sprite s, int id)
public int Sprite.ShowLayer(int id);public static int SplashKit.SpriteShowLayer(Sprite s, int id);
def sprite_show_layer(s, id):
function SpriteShowLayer(s: Sprite; id: Integer): Integer
Sprite Speed
Returns the current speed (distance travelled per update) of the sprite.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to get the details from. |
Return Type: Float
Signatures:
float sprite_speed(sprite s)
public float Sprite.Speed { get }public static float SplashKit.SpriteSpeed(Sprite s);
def sprite_speed(s):
function SpriteSpeed(s: Sprite): Single
Sprite Start Animation
Sprite Start Animation
Start playing an animation from the sprite’s animation template. This will play a sound effect if the first cell of the animation has a sound.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to start the animation of. |
named | String | The name of the animation to start from the animation script. |
Signatures:
void sprite_start_animation(sprite s, const string &named)
public void Sprite.StartAnimation(string named);public static void SplashKit.SpriteStartAnimation(Sprite s, string named);
def sprite_start_animation_named(s, named):
procedure SpriteStartAnimation(s: Sprite; const named: String)
Sprite Start Animation
Start playing an animation from the sprite’s animation template. The with_sound parameter determines whether to play a sound effect if the first cell of the animation has a sound.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to start the animation of. |
named | String | The name of the animation to start from the animation script. |
with_sound | Boolean | If false, the animation will not play associated sound effects when started. |
Signatures:
void sprite_start_animation(sprite s, const string &named, bool with_sound)
public void Sprite.StartAnimation(string named, bool withSound);public static void SplashKit.SpriteStartAnimation(Sprite s, string named, bool withSound);
def sprite_start_animation_named_with_sound(s, named, with_sound):
procedure SpriteStartAnimation(s: Sprite; const named: String; withSound: Boolean)
Sprite Start Animation
Start playing an animation from the sprite’s animation template. This will play a sound effect if the first cell of the animation has a sound.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to start the animation of. |
idx | Integer | The index of the animation to start from the animation script. |
Signatures:
void sprite_start_animation(sprite s, int idx)
public void Sprite.StartAnimation(int idx);public static void SplashKit.SpriteStartAnimation(Sprite s, int idx);
def sprite_start_animation(s, idx):
procedure SpriteStartAnimation(s: Sprite; idx: Integer)
Sprite Start Animation
Start playing an animation from the sprite’s animation template. The with_sound parameter determines whether to play a sound effect if the first cell of the animation has a sound.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to start the animation of. |
idx | Integer | The index of the animation to start from the animation script. |
with_sound | Boolean | If false, the animation will not play associated sound effects when started. |
Signatures:
void sprite_start_animation(sprite s, int idx, bool with_sound)
public void Sprite.StartAnimation(int idx, bool withSound);public static void SplashKit.SpriteStartAnimation(Sprite s, int idx, bool withSound);
def sprite_start_animation_with_sound(s, idx, with_sound):
procedure SpriteStartAnimation(s: Sprite; idx: Integer; withSound: Boolean)
Sprite Stop Calling On Event
Removes an event handler from the sprite, stopping events from this sprite calling the indicated method.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to remove the handler from |
handler | Sprite Event Handler | The function to remove from this sprites handlers |
Signatures:
void sprite_stop_calling_on_event(sprite s, sprite_event_handler *handler)
public void Sprite.StopCallingOnEvent(SpriteEventHandler handler);public static void SplashKit.SpriteStopCallingOnEvent(Sprite s, SpriteEventHandler handler);
def sprite_stop_calling_on_event(s, handler):
procedure SpriteStopCallingOnEvent(s: Sprite; handler: SpriteEventHandler)
Sprite Toggle Layer Visible
Sprite Toggle Layer Visible
Toggle the visibility of the specified layer of the sprite.
Parameters:
Name | Type | Description |
---|---|---|
s | Sprite | The sprite to change. |
name | String | The name of the layer to toggle. |
Signatures:
void sprite_toggle_layer_visible(sprite s, const string &name)
public void Sprite.ToggleLayerVisible(string name);public static void SplashKit.SpriteToggleLayerVisible(Sprite s, string name);