From 37a032cc337b7acdbb4792fac73df78682959242 Mon Sep 17 00:00:00 2001 From: Blake Lingenau Date: Tue, 1 Mar 2016 14:01:11 -0500 Subject: [PATCH] Added cycling sprite functionality/animation --- Source/FullScreenPokemon.js | 8 ++++++++ Source/FullScreenPokemon.ts | 13 +++++++++++++ Source/settings/sprites.js | 12 ++++++++++++ 3 files changed, 33 insertions(+) diff --git a/Source/FullScreenPokemon.js b/Source/FullScreenPokemon.js index 41dbdcba..27cecb24 100644 --- a/Source/FullScreenPokemon.js +++ b/Source/FullScreenPokemon.js @@ -737,6 +737,9 @@ var FullScreenPokemon; */ FullScreenPokemon.prototype.keyDownSelect = function (thing, event) { thing.FSP.ModAttacher.fireEvent("onKeyDownSelect"); + if (thing.FSP.MenuGrapher.getActiveMenu()) { + return; + } if (!thing.FSP.toggleCycling(thing)) { thing.FSP.displayMessage(thing, thing.FSP.MathDecider.getConstant("items").Bicycle.error); } @@ -1023,6 +1026,8 @@ var FullScreenPokemon; thing.cycling = true; thing.speedOld = thing.speed; thing.speed = this.MathDecider.compute("cycleSpeed", thing); + thing.FSP.addClass(thing, "cycling"); + thing.FSP.displayMessage(thing, "%%%%%%%PLAYER%%%%%%% got on the bicycle!"); return true; }; /** @@ -1033,6 +1038,9 @@ var FullScreenPokemon; FullScreenPokemon.prototype.stopCycling = function (thing) { thing.cycling = false; thing.speed = thing.speedOld; + thing.FSP.removeClass(thing, "cycling"); + thing.FSP.TimeHandler.cancelClassCycle(thing, "cycling"); + thing.FSP.displayMessage(thing, "%%%%%%%PLAYER%%%%%%% got off the bicycle."); }; /** * Toggles the Player's cycling status. diff --git a/Source/FullScreenPokemon.ts b/Source/FullScreenPokemon.ts index 7bdf676b..6adffec8 100644 --- a/Source/FullScreenPokemon.ts +++ b/Source/FullScreenPokemon.ts @@ -1015,6 +1015,10 @@ module FullScreenPokemon { keyDownSelect(thing: ICharacter, event?: Event): void { thing.FSP.ModAttacher.fireEvent("onKeyDownSelect"); + if (thing.FSP.MenuGrapher.getActiveMenu()) { + return; + } + if (!thing.FSP.toggleCycling(thing)) { thing.FSP.displayMessage(thing, thing.FSP.MathDecider.getConstant("items").Bicycle.error); } @@ -1355,6 +1359,10 @@ module FullScreenPokemon { thing.cycling = true; thing.speedOld = thing.speed; thing.speed = this.MathDecider.compute("cycleSpeed", thing); + + thing.FSP.addClass(thing, "cycling"); + + thing.FSP.displayMessage(thing, "%%%%%%%PLAYER%%%%%%% got on the bicycle!"); return true; } @@ -1366,6 +1374,11 @@ module FullScreenPokemon { stopCycling(thing: IPlayer): void { thing.cycling = false; thing.speed = thing.speedOld; + + thing.FSP.removeClass(thing, "cycling"); + thing.FSP.TimeHandler.cancelClassCycle(thing, "cycling"); + + thing.FSP.displayMessage(thing, "%%%%%%%PLAYER%%%%%%% got off the bicycle."); } /** diff --git a/Source/settings/sprites.js b/Source/settings/sprites.js index 12a8a965..d630ad3f 100644 --- a/Source/settings/sprites.js +++ b/Source/settings/sprites.js @@ -265,6 +265,18 @@ FullScreenPokemon.FullScreenPokemon.settings.sprites = { "normal": "p[0,1,2,4]x021,x26,x09,2x36,2x07,2x38,2x06,2x38,2x05,2223111132220000x212,000212x18,212002111121121111200222112112112200021221133112320000x210,12x05,22322221122x06,222332112x07,23322022x09,222x08,", "up": "p[0,1,2,4]x021,x26,x09,2x36,2x07,2x38,2x06,2x38,2x05,22x38,220000222x36,22200021x210,1200211x28,1120022211222211220002122233332222000022232222321120000223311332112x05,2233332222x06,232222x011,222x08,", "left": "p[0,1,2,4]x021,x26,x09,2x36,2x07,2x38,2x05,221x37,2000021111x35,222000022333x27,x05,21211x26,x05,2121121122x06,2x17,2x08,231112232x08,x26,32x06,x26,1122x05,233233211232x05,233x25,332x06,222000022000" + }, + "cycling": { + "normal": { + "normal": "p[0,1,2,4]0000x28,x07,2x38,2x06,2x38,2x05,2223111132220000221x26,122000212x18,21200211112112111120002211211211220000222113311222000211x28,11200211x28,112000x25,33x25,x05,2332332332x07,22233222x010,2332x013,22x07,", + "up": "p[0,1,2,4]0000x28,x07,2x38,2x06,2x38,2x05,222x36,2220000x212,00021x210,1200211x28,11200022112222112200002122111122120000222322223222x05,22x36,22x05,2322333322320000233x26,332x05,2222332222x09,2332x013,22x07,", + "left": "p[0,1,2,4]0000x28,x07,2x38,2x06,21x37,2x05,2122x35,22200002211x28,x05,21211x26,x05,2121121122x06,2x17,2x06,21231112232x05,21x26,332200002211x28,00023211222233320023x27,3222320232222332322232002333x25,33320000222x05,222000" + }, + "walking": { + "normal": "p[0,1,2,4]0000x28,x07,2x38,2x06,2x38,2x05,2223111132220000221x26,122000212x18,21200211112112111120002211211211220000222113311222000211x28,11200211x28,112000x25,3323322x05,222233222x07,2332332x010,222332x013,22x07,", + "up": "p[0,1,2,4]0000x28,x07,2x38,2x06,2x38,2x05,222x36,2220000x212,00021x210,1200211x28,11200022112222112200002122111122120000222322223222x05,22x36,232x05,22233332332000023x29,x05,233223322x08,2202332x013,22x07,", + "left": "p[0,1,2,4]0000x28,x07,2x38,2x06,21x37,2x05,2122x35,22200002211x28,x05,21211x26,x05,2121121122x06,2x17,2x06,21231112232x05,21x26,332200002211x28,00023211222233320023x27,3222320232223x27,32002333223323332000022200x26,000" + } } }, "Pokeball": "p[0,1,2,3]x038,2222x010,22333322x07,2333113332x06,2333113332x05,2x310,200002x310,20000211x36,11200002x110,2x05,2x18,2x06,2x18,2x07,22111122x010,2222x038,",