1 /**********************************************************************************
2 * Copyright (c) 2008, 2009 Derek Yu and Mossmouth, LLC
3 * Copyright (c) 2010, Moloch
4 * Copyright (c) 2018, Ketmar Dark
6 * This file is part of Spelunky.
8 * You can redistribute and/or modify Spelunky, including its source code, under
9 * the terms of the Spelunky User License.
11 * Spelunky is distributed in the hope that it will be entertaining and useful,
12 * but WITHOUT WARRANTY. Please see the Spelunky User License for more details.
14 * The Spelunky User License should be available in "Game Information", which
15 * can be found in the Resource Explorer, or as an external file called COPYING.
16 * If not, please obtain a new copy of Spelunky from <http://spelunkyworld.com/>
18 **********************************************************************************/
20 class MapObjYellowTrail['oYellowTrail'] : MapObject;
23 override bool initialize () {
24 if (!::initialize()) return false;
25 setSprite('sYellowTrail');
30 override void onAnimationLooped () {
35 override void thinkFrame () {
46 // ////////////////////////////////////////////////////////////////////////// //
48 class ItemWebBall['oWebBall'] : MapObject;
51 int trailTime = -1; //4
54 override bool initialize () {
55 if (!::initialize()) return false;
56 setSprite('sWebBall');
57 yVel = -(global.randOtherFloat(3)+1);
58 xVel = global.randOther(1, 3);
59 if (global.randOther(1, 2) == 1) xVel *= -1;
60 life = global.randOther(20, 100);
65 override void onAnimationLooped () {
66 if (spriteLName == 'sWebCreate') {
67 auto obj = ItemWeb(level.MakeMapObject(ix-8, iy-8, 'oWeb'));
68 if (obj) obj.dying = true;
75 setSprite('sWebCreate');
81 override void thinkFrame () {
82 if (--trailTime == 0) {
83 level.MakeMapObject(ix, iy, 'oYellowTrail');
84 trailTime = default.trailTime;
89 if (yVel < 6) yVel += 0.2;
90 // if (yVel > 0) yVel = 0; // in the original
92 if (life > 0) life -= 1; else { createWeb(); return; }
94 level.checkTilesInRect(x0, y0, width, height, delegate bool (MapTile o) {
95 if (!o.collidesWith(self)) return false;
96 if (o.spectral || !o.visible || (!o.solid && !o.water)) return false;
101 if (spriteLName == 'sWebCreate') return;
103 level.isObjectInRect(x0, y0, width, height, delegate bool (MapObject o) {
104 if (!o.collidesWith(self)) return false;
107 auto enemy = MapEnemy(o);
109 if (enemy.dead || enemy isa EnemyGiantSpiderHang) return false;
115 if (o isa MapItem) { createWeb(); return true; }
124 objName = 'Web Ball';
127 bounce = false; // true?
132 imageSpeed = 1; //???
134 setCollisionBounds(-8, -8, 7, 7);