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 WeaponWhipBase : PlayerWeapon abstract;
21 override bool initialize () {
22 if (!::initialize()) return false;
28 override bool collidesWithObject (MapObject o) {
29 return (o && o.collidesWith(self, true));
34 override void onAnimationLooped () {
40 // ////////////////////////////////////////////////////////////////////////// //
41 class WeaponWhipPre['oWhipPre'] : WeaponWhipBase;
44 override void fixSprite () {
45 if (level.player.dir == Dir.Left) {
46 setSprite('sWhipPreL');
47 setXY(level.player.fltx+16, level.player.flty);
48 prevFltX = level.player.prevFltX+16;
49 prevFltY = level.player.prevFltY;
51 setSprite('sWhipPreR');
52 setXY(level.player.fltx-16, level.player.flty);
53 prevFltX = level.player.prevFltX-16;
54 prevFltY = level.player.prevFltY;
56 setCollisionBounds(0, 0, 15, 15);
65 dontChangeWhipTimer = true; // original game does this
69 // ////////////////////////////////////////////////////////////////////////// //
70 class WeaponWhip['oWhip'] : WeaponWhipBase;
75 override bool initialize () {
76 long = (global.config.scumWhipUpgrade == 1);
77 return ::initialize();
81 override void fixSprite () {
83 setSprite(level.player.dir == Dir.Left ? 'sWhipLongLeft' : 'sWhipLongRight');
84 if (level.player.dir == Dir.Left) {
85 setCollisionBounds(7, 6, 31, 12);
87 setCollisionBounds(0, 6, 24, 12);
90 setSprite(level.player.dir == Dir.Left ? 'sWhipLeft' : 'sWhipRight');
91 if (level.player.dir == Dir.Left) {
92 setCollisionBounds(3, 6, 23, 12);
94 setCollisionBounds(0, 6, 20, 12);
97 setCollisionBounds(0, 0, 15, 15);
99 if (level.player.dir == Dir.Left) {
100 setXY(level.player.fltx-16, level.player.flty);
101 prevFltX = level.player.prevFltX-16;
102 prevFltY = level.player.prevFltY;
104 setXY(level.player.fltx+16, level.player.flty);
105 prevFltX = level.player.prevFltX+16;
106 prevFltY = level.player.prevFltY;
111 override void thinkFrame () {
113 if (!isInstanceAlive) return;