-
-
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.
- Split off WallSide into Renderable - Based Enemy off of Renderable - Level has the enemies array, which is loads in from a second layer in Tiled - Enemies walk around just randomly
- Loading branch information
1 parent
c5b729e
commit 5f6ee8c
Showing
13 changed files
with
321 additions
and
108 deletions.
There are no files selected for viewing
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,3 @@ | ||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Renderable/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Renderables/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary> |
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,42 @@ | ||
using GXPEngine.Core; | ||
|
||
namespace GXPEngine.MyGame | ||
{ | ||
public class Enemy : Renderable | ||
{ | ||
public Vector2 enemyPosition => position; | ||
public Vector2 edge1 => p1; | ||
public Vector2 edge2 => p2; | ||
|
||
private Sprite minimapTexture { get; } | ||
|
||
private const float MOVE_STEP = 0.01f; | ||
|
||
public Enemy(string filename, float x, float y) : base(filename) | ||
{ | ||
position = new Vector2(x, y); | ||
minimapTexture = new Sprite(filename, true, false); | ||
} | ||
|
||
public void Move() | ||
{ | ||
float xMove = Utils.Random(-MOVE_STEP, MOVE_STEP) * Time.deltaTime; | ||
float yMove = Utils.Random(-MOVE_STEP, MOVE_STEP) * Time.deltaTime; | ||
|
||
if (MyGame.level.GetTileAtPosition(Mathf.Floor(position.x + xMove), Mathf.Floor(position.y + yMove)).GetType() | ||
== typeof(TileWall)) return; | ||
position.x += xMove; | ||
position.y += yMove; | ||
} | ||
|
||
public override void RefreshVisuals() | ||
{ | ||
normal = Player.heading.Copy().Mult(-1.0f); | ||
|
||
Minimap.DrawEnemy(minimapTexture, position); | ||
|
||
CalculatePointsInWorldSpace(); | ||
base.RefreshVisuals(); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.