Sprite Functions

1.Quick Glance

 

Sprite Functions are GPE or GameObject functions used to get data on a sprite, render it under certain conditions or more. By default, objects render their own sprites with calculated data if their render function is not overwritten.

 

2.Sprite Functions

SpriteObject GPE.get_sprite_object( int spriteId)

Retrieves the GPE Sprite object assigned to an id. Although, usage of this function will be rare. Feel free to checkout all of the interesting properties and meta data of an sprite object here.

Scope: GPE

Return type : SpriteObject

Parameters:

  • int spriteId– an integer of a sprite(aka spr_player_walk). If undefined, null or non-number based this function returns IS_NULL.

 

int GameObject.get_sprite( )

Returns the sprite id assigned to the game object.

Scope: GPE

Return type : int

Parameters:  none

 

int GPE.get_sprite_width( int spriteId)

Retrieves the width of a sprite whose id is spriteId.  Returns 0 by default

Scope: GPE

Return type : SpriteObject

Parameters:

  • int spriteId– an integer of a sprite(aka spr_player_walk). If undefined, null or non-number based this function returns 0.

 

int GPE.get_sprite_height( int spriteId)

Retrieves the height of a sprite whose id is spriteId.  Returns 0 by default

Scope: GPE

Return type : SpriteObject

Parameters:

  • int spriteId– an integer of a sprite(aka spr_player_walk). If undefined, null or non-number based this function returns 0.

 

int GPE.get_sprite_length( int spriteId)

Retrieves the number of frames of a sprite whose id is spriteId.  Returns 0 by default

Scope: GPE

Return type : SpriteObject

Parameters:

  • int spriteId– an integer of a sprite(aka spr_player_walk). If undefined, null or non-number based this function returns 0.

 

void GPE.render_sprite( int spriteIdIn, int frameNumb, int xOn, int yOn, float scaleX, float scaleY)

Retrieves the width of a sprite whose id is spriteId.  Returns 0 by default

Scope: GPE

Return type : void

Parameters:

  • int spriteId– an integer of a sprite(aka spr_player_walk). If undefined, null or non-number based this function returns 0.
  • int frameNumb – the frame number of the animation to render.
  • int xOn – the x-coordinate relative to the current camera to render the sprite.
  • int yOn – the x-coordinate relative to the current camera to render the sprite
  • float scaleX – Used to scale the current frame on the x-axis. Defaults to 1.
  • float scaleY – Used to scale the current frame on the y-axis. Defaults to 1.

 

void GPE.render_sprite_rotated( int spriteIdIn, int frameNumb, int xOn, int yOn, Degree rotation, float scaleX, float scaleY)

Retrieves the width of a sprite whose id is spriteId.  Returns 0 by default

Scope: GPE

Return type : void

Parameters:

  • int spriteId– an integer of a sprite(aka spr_player_walk). If undefined, null or non-number based this function returns 0.
  • int frameNumb – the frame number of the animation to render.
  • int xOn – the x-coordinate relative to the current camera to render the sprite.
  • int yOn – the x-coordinate relative to the current camera to render the sprite
  • Degree rotation – the angle in which to render the sprite(in degrees ). Use gpe.degree() to convert radians to degrees for this function if needed.
  • float scaleX – Used to scale the current frame on the x-axis. Defaults to 1.
  • float scaleY – Used to scale the current frame on the y-axis. Defaults to 1.

 

void GameObject.set_sprite( int spriteId)

Sets the new sprite of an object based on the id.

Scope: GPE

Return type : void

Parameters:

  • int spriteId– an integer of a sprite(aka spr_player_walk). If undefined, null or non-number based this function does nothing.

Suggest Edit