Instantly share code, notes, and snippets.

Embed
What would you like to do?
12.3 Have the Boss shoot more
' Game Class
Method OnUpdate()
'...............
Else
Self.final_boss.Update(engine.GetCanvasWidth(), engine.GetCanvasHeight())
' change the boss' shooting pattern to 3 projectiles
If Self.final_boss.FireProjectile()
Local boss_width:Float = final_boss.box.GetWidth()
Local boss_height:Float = final_boss.box.GetHeight()
CreateProjectile(final_boss, 100, boss_height/2 * -1)
CreateProjectile(final_boss, 50)
CreateProjectile(final_boss, 0, boss_height/2)
End
End
End
'......................
' Update the Create Projectile method for new Bullet patterns
Method CreateProjectile(character:Character, width_modifier:Float=0, height_modifier:Float=0)
Local projectile_box:ftObject = Self.engine.CreateBox(20, 10,
character.box.GetPosX() + character.box.GetWidth()/2 + width_modifier,
character.box.GetPosY() + height_modifier)
projectile_box.SetColGroup(PROJECTILES)
If (character.character_type = "PLAYER")
projectile_box.SetSpeedX(10)
projectile_box.SetColor(0, 255, 255)
projectile_box.SetColWith(ENEMY_GROUP, True)
Else
' width modifier needs to go here for enemies
projectile_box.SetPosX(character.box.GetPosX() - character.box.GetWidth()/2 + width_modifier)
projectile_box.SetSpeedX(-10)
projectile_box.SetColor(200, 200, 0)
projectile_box.SetColWith(PLAYER_GROUP, True)
End
projectile_box.SetText("PROJECTILE")
Self.projectiles.AddLast(New Projectile(projectile_box, character.projectile_type))
End
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment