View fourteen_six.monkey
' Fire and run pattern | |
Function ShootAndScootPattern(box:ftObject, game_width:Float, game_height:Float, max_y_speed:Float=5.0) | |
If (box.GetSpeedY() < 0.1 And box.GetSpeedY() > -0.1) | |
If (box.GetPosX() < game_width/1.5) | |
' Using the boxes Tag property to tell enemies to fire | |
box.SetTag(1) | |
If (box.GetPosY() > game_height/2) | |
box.SetSpeedY(max_y_speed * -1) | |
Else | |
box.SetSpeedY(max_y_speed) |
View fourteen_five.monkey
' New stepped height change pattern | |
Function StepChangeHeightPattern(box:ftObject, game_width:Float, game_height:Float, | |
start_x:Float, start_y:Float, step_width:Float=100.0, | |
step_height:Float=25.0, number_of_steps:Int=10, max_y_speed:Float=5.0) | |
Local current_x:Float = box.GetPosX() | |
Local current_y:Float = box.GetPosY() | |
Local modifier:Int = 1 | |
If (start_y > game_height/2) | |
modifier = -1 | |
End |
View fourteen_six.monkey
Import fantomX | |
Class CustomEngine Extends ftEngine | |
Method OnObjectCollision:Int(obj_one:ftObject, obj_two:ftObject) | |
' Change all of our engine checks to use Contains() instead of = so we can use various enemy types | |
If (obj_one.GetText().Contains("PLAYER") And (obj_two.GetText().Contains("ENEMY") Or obj_two.GetText().Contains("FINALBOSS"))) | |
CharacterCollision(obj_one, obj_two) | |
Else If (obj_two.GetText().Contains("PLAYER") And (obj_one.GetText().Contains("ENEMY") Or obj_one.GetText().Contains("FINALBOSS"))) | |
CharacterCollision(obj_two, obj_one) |
View fourteen_five.monkey
' Game Class | |
' Modify the CreateEnemy method to set the enemies box Text different | |
' for each enemy so the type is set properly | |
Method CreateEnemy() | |
Local rand_enemy:Float = Rnd(0, 3) | |
Local projectile_type:ProjectileType = New ProjectileType() | |
Local width = 48 | |
Local height = 32 | |
Local health = 1 |
View fourteen_four.monkey
Import fantomX | |
Import projectile_type | |
' include our ai movement patterns | |
Import ai_movement | |
Class Character | |
Field box:ftObject | |
Field current_health:Int | |
Field max_health:Int |
View fourteen_three.monkey
Import fantomX | |
' Added this file to hold our various AI movement patterns | |
Function SimpleBossPattern(box:ftObject, game_width:Float, game_height:Float) | |
Local y_speed:Float = box.GetSpeedY() | |
Local x_speed:Float = box.GetSpeedX() | |
If (box.GetPosY() < 0) | |
box.SetSpeedY(y_speed + 0.5) |
View fourteen_two.monkey
Method CreatePlayer() | |
' load the new, smaller player image from the modified sprite sheet, and add the animation frame count | |
Local box:ftObject = engine.CreateAnimImage(game_sprite_atlas.GetImage("player_submarine_two_animation"), 0, 0, | |
96, game_sprite_atlas.GetImageHeight("player_submarine_two_animation"), 4, engine.GetCanvasWidth()/2, engine.GetCanvasHeight()/2) | |
box.SetMaxSpeed(10.0) | |
box.SetMinSpeed(-10.0) | |
box.SetFriction(0.5) | |
box.SetColGroup(PLAYER_GROUP) | |
box.SetColType(Self.engine.ctBox) | |
box.SetText("PLAYER") |
View fourteen_one.monkey
Method CreatePlayer() | |
Local box:ftObject = engine.CreateAnimImage(game_sprite_atlas.GetImage("player_submarine_anim"), 0, 0, | |
128, game_sprite_atlas.GetImageHeight("player_submarine_anim"), 3, engine.GetCanvasWidth()/2, engine.GetCanvasHeight()/2) | |
' Change the player max speed and add friction | |
box.SetMaxSpeed(10.0) | |
box.SetMinSpeed(-10.0) | |
box.SetFriction(0.5) | |
box.SetColGroup(PLAYER_GROUP) | |
box.SetColType(Self.engine.ctBox) | |
box.SetText("PLAYER") |
View thirteen_five.monkey
' Give the boss an image from the sprite sheet | |
Method CreateFinalBoss() | |
Local box:ftObject = Self.engine.CreateImage(game_sprite_atlas.GetImage("tutorial_boss"), 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, 0.2, 25, 1.5) |
View thirteen_four.monkey
' use our sprite atlas for projectiles | |
Method CreateProjectile(character:Character, width_modifier:Float=0, height_modifier:Float=0) | |
Local projectile_box:ftObject | |
If (character.character_type = "PLAYER") | |
projectile_box = Self.engine.CreateImage(game_sprite_atlas.GetImage("player_projectile"), | |
character.box.GetPosX() + character.box.GetWidth()/2 + width_modifier, | |
character.box.GetPosY() + height_modifier) | |
projectile_box.SetSpeedX(10) | |
projectile_box.SetColor(0, 255, 255) | |
projectile_box.SetColWith(ENEMY_GROUP, True) |
NewerOlder