-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
`Player` wasn't having hit detection because of the mirrored `scaleX`. It might be a bug in Futile, so I just modified the `GetTextureRectRelativeToContainer()` method in order to "fix" it. An issue has been filed [here](MattRix/Futile#215).
- Loading branch information
1 parent
7892703
commit dc75e4e
Showing
28 changed files
with
642 additions
and
273 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using UnityEngine; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using System; | ||
|
||
public class BasicEnemy : Enemy | ||
{ | ||
private float speedX = 3.0f; | ||
private float speedY = 0.0f; | ||
private float shotrate = RXRandom.Range (60.0f,80.0f); | ||
|
||
private float frameCount = 0; | ||
|
||
public BasicEnemy() : base("Monkey_0") | ||
{ | ||
this.x = Futile.screen.halfWidth; | ||
this.y = RXRandom.Range(-Futile.screen.halfHeight, Futile.screen.halfHeight); | ||
// once the sprites are swopped out, this needs to be forgone for | ||
// sprites with proper resolution in the first place | ||
this.scale = 0.25f; | ||
} | ||
|
||
public BasicEnemy( float x, float y ) : base(x, y) | ||
{ | ||
} | ||
|
||
override public void HandleUpdate() | ||
{ | ||
|
||
this.x -= speedX; | ||
this.y += speedY; | ||
|
||
// enemy shoots | ||
if(frameCount % shotrate == 0) | ||
{ | ||
_shotStrategy.shoot(this.x, this.y, true); | ||
} | ||
frameCount += 1; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using System.Collections.Generic; | ||
using System; | ||
|
||
public class BossEnemy : Enemy | ||
{ | ||
private float speedX = 0.5f; | ||
private float shotrate = 40.0f; | ||
private float frameCount = 0; | ||
private int direction = -1; | ||
|
||
public BossEnemy() : base("Monkey_0") | ||
{ | ||
this.x = Futile.screen.halfWidth; | ||
this.y = 0f; | ||
this.scale = 0.5f; | ||
} | ||
|
||
public BossEnemy( float x, float y) : base(x, y) | ||
{ | ||
} | ||
|
||
override public void HandleUpdate() | ||
{ | ||
//movement of boss, slowly moves across screen and up and down | ||
this.x -= speedX; | ||
this.y -= direction * 1.5f; | ||
if (this.y >= Futile.screen.halfHeight - 10f || this.y <= -Futile.screen.halfHeight + 10f) | ||
direction = direction * -1; | ||
|
||
// enemy shoots | ||
if (frameCount % shotrate == 0) | ||
{ | ||
_shotStrategy.shoot(this.x, this.y, true); | ||
} | ||
frameCount += 1; | ||
} | ||
|
||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using UnityEngine; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using System; | ||
|
||
public static class EnemyFactory | ||
{ | ||
public static Enemy generateEnemy( string enemyName, float x, float y ) | ||
{ | ||
// this should really be changed, so LevelEvents have some | ||
// sort of EnemyType built into them, so they can be type- | ||
// checked versus being a string. | ||
// | ||
|
||
if( enemyName.Equals( "enemy1" ) ) | ||
{ | ||
return new BasicEnemy(x, y); | ||
} else if( enemyName.Equals( "boss1" ) ) | ||
{ | ||
Enemy _myEnemy = new BossEnemy(x, y); | ||
_myEnemy.setShotStrategy(new FanShotStrategy()); | ||
return _myEnemy; | ||
} else | ||
{ | ||
Debug.Log( "not a valid EnemyType!" ); | ||
return null; | ||
} | ||
|
||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.