Added ability to configure which enemy ID is selected, what facing directions are set and adding/removing entities.
This commit is contained in:
parent
d44fbb5033
commit
926b43878e
@ -65,6 +65,18 @@ void Editor::Update(float fElapsedTime){
|
||||
if (game->GetMouse(1).bPressed) {
|
||||
t.enemyId = EnemyID::NONE;
|
||||
}
|
||||
if (game->GetKey(DOWN).bHeld) {
|
||||
t.facingDir = FacingDirection::SOUTH;
|
||||
}
|
||||
if (game->GetKey(RIGHT).bHeld) {
|
||||
t.facingDir = FacingDirection::EAST;
|
||||
}
|
||||
if (game->GetKey(UP).bHeld) {
|
||||
t.facingDir = FacingDirection::NORTH;
|
||||
}
|
||||
if (game->GetKey(LEFT).bHeld) {
|
||||
t.facingDir = FacingDirection::WEST;
|
||||
}
|
||||
game->FillRectDecal(squarePos, GRID_SIZE, { 0,0,255,64 });
|
||||
}
|
||||
//game->DrawRectDecal(squarePos,GRID_SIZE,{64,64,64});
|
||||
@ -79,6 +91,9 @@ void Editor::Update(float fElapsedTime){
|
||||
}
|
||||
else {
|
||||
game->DrawDecal(squarePos, game->circle, { 1,1 }, game->GetData(t.enemyId).col);
|
||||
if (t.enemyId >= START) {
|
||||
game->DrawRotatedDecal(squarePos + vf2d{16, 16}, game->arrow, PI / 2 * (int)t.facingDir, { 16,16 }, { 1,1 }, WHITE);
|
||||
}
|
||||
}
|
||||
}
|
||||
game->DrawLineDecal(squarePos,{squarePos.x+ (float)GRID_SIZE.x,squarePos.y},t.wallN?WHITE:Pixel{64,64,64});
|
||||
|
@ -9,6 +9,7 @@ enum class FacingDirection {
|
||||
enum EnemyID {
|
||||
NONE,
|
||||
EXIT,
|
||||
START,
|
||||
SHOOTME,
|
||||
COIN = 56,
|
||||
POWERUP_ARMOR = 57,
|
||||
|
BIN
Faceball2030/assets/arrow.png
Normal file
BIN
Faceball2030/assets/arrow.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.1 KiB |
@ -9,7 +9,9 @@ using namespace olc;
|
||||
FaceBall* game;
|
||||
|
||||
void FaceBall::InitializeEnemyData() {
|
||||
enemyData[EnemyID::NONE] = { "VOID",BLACK };
|
||||
enemyData[EXIT] = { "EXIT",GREEN };
|
||||
enemyData[START] = { "SPAWN POSITION",{128,64,0} };
|
||||
enemyData[SHOOTME] = { "SHOOTME",YELLOW,1,1,PI / 8,2,1,3 };
|
||||
enemyData[COIN] = { "Coin",BLUE };
|
||||
enemyData[POWERUP_ARMOR] = { "Armor",{96,0,96} };
|
||||
@ -606,6 +608,7 @@ bool FaceBall::OnUserCreate()
|
||||
matProj = Matrix_MakeProjection(90.0f, (float)ScreenHeight() / (float)ScreenWidth(), 0.1f, 1000.0f);
|
||||
dot = new Decal(new Sprite("assets/dot.png"));
|
||||
circle = new Decal(new Sprite("assets/circle.png"));
|
||||
arrow = new Decal(new Sprite("assets/arrow.png"));
|
||||
enemy_ShootMe_tex = new Decal(new Sprite("assets/enemies/ShootMe.png"));
|
||||
|
||||
InitializeEnemyData();
|
||||
|
@ -149,7 +149,7 @@ class FaceBall : public PixelGameEngine
|
||||
}
|
||||
|
||||
EnemyData GetData(EnemyID id);
|
||||
Decal* circle;
|
||||
Decal* circle,*arrow;
|
||||
private:
|
||||
Mesh mapMesh;
|
||||
|
||||
|
@ -2891,6 +2891,7 @@ namespace olc
|
||||
di.pos.resize(4);
|
||||
di.uv = { { 0.0f, 0.0f}, {0.0f, 1.0f}, {1.0f, 1.0f}, {1.0f, 0.0f} };
|
||||
di.w = { 1, 1, 1, 1 };
|
||||
di.z = { 0,0,0,0 };
|
||||
di.tint = { tint, tint, tint, tint };
|
||||
di.points = 4;
|
||||
di.pos[0] = (olc::vf2d(0.0f, 0.0f) - center) * scale;
|
||||
|
Loading…
x
Reference in New Issue
Block a user