1 /**********************************************************************************
2 * Copyright (c) 2008, 2009 Derek Yu and Mossmouth, LLC
3 * Copyright (c) 2018, Ketmar Dark
5 * This file is part of Spelunky.
7 * You can redistribute and/or modify Spelunky, including its source code, under
8 * the terms of the Spelunky User License.
10 * Spelunky is distributed in the hope that it will be entertaining and useful,
11 * but WITHOUT WARRANTY. Please see the Spelunky User License for more details.
13 * The Spelunky User License should be available in "Game Information", which
14 * can be found in the Resource Explorer, or as an external file called COPYING.
15 * If not, please obtain a new copy of Spelunky from <http://spelunkyworld.com/>
17 **********************************************************************************/
18 class EnemyAlien['oAlien'] : MapEnemy;
21 override bool initialize () {
22 if (!::initialize()) return false;
24 dir = global.randOther(0, 1);
29 // ////////////////////////////////////////////////////////////////////////// //
30 override void thinkFrame () {
32 if (!isInstanceAlive) return;
35 //done in basic hanler: if (collision_point(x+8, y+8, oSolid, 0, 0)) hp = 0;
37 /+done in basic hanler:
39 scrCreateBlood(x+8, y+8, 3);
41 if (isRealLevel()) global.enemyKills[15] += 1;
49 yVel = fmin(yVel+0.6, 42.0);
53 if (isCollisionBottom(1) && status != STUNNED) yVel = 0;
56 if (counter > 0) --counter;
58 dir = global.randOther(0, 1);
61 } else if (status == WALK) {
62 if (isCollisionRight(1)) dir = Dir.Left;
63 if (isCollisionLeft(1)) dir = Dir.Right;
64 if (dir == Dir.Left && !level.isSolidAtPoint(x-1, y) && !level.isSolidAtPoint(x-1, y+16)) {
66 } else if (dir == Dir.Right && !level.isSolidAtPoint(x+16, y) && !level.isSolidAtPoint(x+16, y+16)) {
70 if ((!level.isSolidAtPoint(x-1, y+16) || level.isSolidAtPoint(x-1, y)) &&
71 (!level.isSolidAtPoint(x+16, y+16) || level.isSolidAtPoint(x+16, y)))
73 dir = (level.isSolidAtPoint(x-1, y) ? Dir.Right : Dir.Left);
75 } else if (dir == Dir.Left) {
81 if (global.randOther(1, 100) == 1) {
83 counter = global.randOther(20, 50);
87 //if (isCollisionSolid()) y -= 2; // in the original
94 desc2 = "A hostile and intelligent extraterrestrial being.";
96 setCollisionBounds(2, 6, 14, 16);
100 yVelLimit = 6; // YASM 1.7
114 doBasicPhysics = false;
116 leavesBody = false; // default processing
117 checkInsideBlock = true;
118 allowWaterProcessing = true;