MCPcopy Create free account
hub / github.com/atraczyk/2d-engine / Enemy

Method Enemy

engine/src/entity.cpp:1197–1238  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1195}
1196
1197Enemy::Enemy(ENEMY_TYPE enemy_type, float x, float y, float w, float h,
1198 float ivx, float ivy, float pl, float pr, float pt, float pb,
1199 TileAtlas* ptexatlas)
1200{
1201 beingHeld = false;
1202 cantHitPlayer = CANTHITPLAYERFRAMES;
1203 toRemove = false;
1204 isAlive = true;
1205 type = enemy_type;
1206 atlas = ptexatlas;
1207 isRunning = false;
1208 inFront = true;
1209 position = Vector2(x, y);
1210 size = Vector2(w, h);
1211 velocity = Vector2(ivx, ivy);
1212 direction = velocity.x >= 0 ? 1 : -1;
1213 leftPadding = pl;
1214 rightPadding = pr;
1215 topPadding = pt;
1216 bottomPadding = pb;
1217 toMove.x = 0;
1218 toMove.y = 0;
1219 currentFrame = 0;
1220 jumpCountDown = JUMPFRAMES;
1221 canJump = true;
1222
1223 switch (type)
1224 {
1225 case ET_KOOPA:
1226 currentAtlasFrame = Point(0, 3);
1227 currentState = CS_MOVINGRIGHT;
1228 break;
1229 case ET_GOOMBA:
1230 currentAtlasFrame = Point(0, 4);
1231 currentState = CS_MOVINGRIGHT;
1232 break;
1233 case ET_SHELL:
1234 currentAtlasFrame = Point(2, 3);
1235 currentState = CS_IDLE;
1236 break;
1237 }
1238};
1239
1240Enemy::~Enemy(){};
1241

Callers

nothing calls this directly

Calls 2

Vector2Class · 0.85
PointClass · 0.85

Tested by

no test coverage detected