Skip to content

Instantly share code, notes, and snippets.

@codetravis
Created January 4, 2017 12:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codetravis/7bd7f0a9ec447da05fb82b902703c88c to your computer and use it in GitHub Desktop.
Save codetravis/7bd7f0a9ec447da05fb82b902703c88c to your computer and use it in GitHub Desktop.
11.1 Creating the Boss
Class Game Extends App
Field engine:ftEngine
Field play_layer:ftLayer
Field play_scene:ftScene
Field game_over_scene:ftScene
Field game_over_layer:ftLayer
Field player:Character
Field enemies:List<Character>
Field last_enemy_time:Float
Field next_enemy_interval:Float
Field projectiles:List<Projectile>
' Add a field to hold the final_boss character
Field final_boss:Character
' .................
' Quick method for creating the final Boss
Method CreateFinalBoss()
Local box:ftObject = Self.engine.CreateBox(120, 200, engine.GetCanvasWidth() - 10, engine.GetCanvasHeight()/2)
box.SetColor(255, 0, 255)
box.SetMaxSpeed(20.0)
box.SetMinSpeed(-20.0)
box.SetColGroup(ENEMY_GROUP)
box.SetColWith(PLAYER_GROUP, True)
box.SetText("FINALBOSS")
Local projectile_type:ProjectileType = New ProjectileType(1, 1000, 1, 10, 1.5)
Self.final_boss = New Character(box, projectile_type, 500, 10)
End
' ....................
End
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment