Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
13.1 Loading player sprite sheet and attaching it to the player
Class Game Extends App
'......................
Field current_level:Int
' add fields to hold new player image
Field player_image:Image
Const FINAL_LEVEL:Int = 2
'.................
End
'......................
Method CreatePlayer()
' load player sprite
player_image = Image.Load("player_submarine_anim.png")
Local box:ftObject = engine.CreateAnimImage(player_image, 0, 0, 128, 64, 3, engine.GetCanvasWidth()/2, engine.GetCanvasHeight()/2)
box.SetMaxSpeed(20.0)
box.SetMinSpeed(-20.0)
box.SetColGroup(PLAYER_GROUP)
box.SetColType(Self.engine.ctBox)
box.SetText("PLAYER")
Local projectile_type:ProjectileType = New ProjectileType()
Self.player = New Character(box, projectile_type, 0, 3, "PLAYER")
End
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment