diff --git a/app/assets/assets.json b/app/assets/assets.json index 61a1f86..d2721a6 100644 --- a/app/assets/assets.json +++ b/app/assets/assets.json @@ -40,7 +40,7 @@ ], "spritesheets" : { "ints_small" : {"size": "16x16" , "frames": 18} - ,"ints_large" : {"size": "16x28" , "frames": 18} + ,"ints_large" : {"size": "16x24" , "frames": 18} ,"playfield_cursor" : {"size": "76x44" , "frames": 3, "animations": { "flash": [0,3], diff --git a/app/assets/images/playfield_vs_frame.png b/app/assets/images/playfield_vs_frame.png index c63d104..3c2c986 100644 Binary files a/app/assets/images/playfield_vs_frame.png and b/app/assets/images/playfield_vs_frame.png differ diff --git a/app/assets/spritesheets/ints_large.png b/app/assets/spritesheets/ints_large.png index a53867e..db7234d 100644 Binary files a/app/assets/spritesheets/ints_large.png and b/app/assets/spritesheets/ints_large.png differ diff --git a/spec/integration/online.spec.ts b/spec/integration/online.spec.ts index 36042c3..40de65a 100644 --- a/spec/integration/online.spec.ts +++ b/spec/integration/online.spec.ts @@ -57,14 +57,14 @@ function press_up(n,key) { describe('Online Simulation', function() { beforeEach(function(){ const init0 = { - countdown: false + countdown: false, seed : 'puzzle', cpu : [false,false], online : true, controls : controls0 } const init1 = { - countdown: false + countdown: false, seed : 'puzzle', cpu : [false,false], online : true, diff --git a/src/renderer/components/playfield_cursor.ts b/src/renderer/components/playfield_cursor.ts index 7a81de6..8ad0188 100644 --- a/src/renderer/components/playfield_cursor.ts +++ b/src/renderer/components/playfield_cursor.ts @@ -30,6 +30,8 @@ export default class ComponentPlayfieldCursor { public mode : string public x : number public y : number + public px_x : number + public px_y : number private visible : boolean /** * Initialises the Cursor's position in x & y, counter, and its sprite @@ -66,16 +68,17 @@ export default class ComponentPlayfieldCursor { this.y = 6 + ROWS_INV let x,y, visible if(this.playfield.stage.countdown.state === MOVING){ - x = ((COLS-2)*UNIT) - this.offset - y = 0 - this.offset visible = false } else { - x = (this.x * UNIT) - this.offset - y = (this.y * UNIT) - this.offset visible = true this.state = 'active' this.map_controls() } + + x = (this.x * UNIT) - this.offset + y = (this.y * UNIT) - this.offset + this.px_x = x + this.px_y = y this.sprite.x = x this.sprite.x = y this.sprite.visible = visible @@ -275,24 +278,28 @@ export default class ComponentPlayfieldCursor { let x = (this.x * UNIT) - this.offset let y = (this.y * UNIT) - this.offset - if(this.state === 'entering') { - // increases by STARTPOS_PANELCURSOR_SPEED until y is reached, then sets it to y - this.sprite.y = this.sprite.y < y ? this.sprite.y + STARTPOS_PANELCURSOR_SPEED : y; - - // once sprite.y has reached its goal position move x the same way - if (this.sprite.y === y) - this.sprite.x = this.sprite.x > x ? this.sprite.x - STARTPOS_PANELCURSOR_SPEED : x; + this.update_entering(x,y) - if (this.sprite.x === x && this.sprite.y === y) { - this.map_controls(); // full control of moving - this.state = "preactive"; - } + if(this.state === 'preactive' || this.state === 'active') { + this.px_x = x + this.px_y = y } - else if(this.state === 'preactive' || this.state === 'active') { - this.sprite.x = x - this.sprite.y = y + + this.update_flickering() + } + + update_entering(x,y){ + if(this.state !== 'entering') { return } + this.px_y = this.px_y < y ? this.px_y + STARTPOS_PANELCURSOR_SPEED : y; + if (this.y === y) { this.px_x = this.px_x > x ? this.px_x - STARTPOS_PANELCURSOR_SPEED : x; } + + if (this.px_x === x && this.px_y === y) { + this.map_controls(); // full control of moving + this.state = "preactive"; } + } + update_flickering(){ if (['entering','preactive'].includes(this.state)) { this.counter_flicker++; if (this.counter_flicker > 1) @@ -301,6 +308,7 @@ export default class ComponentPlayfieldCursor { } } + get stage(){ return this.playfield.stage } @@ -319,11 +327,13 @@ export default class ComponentPlayfieldCursor { this.sprite.visible = true } } - + /** updates the actual sprite position, almost the same as update() */ render() { this.render_visible() this.sprite.frame = this.frame + this.sprite.x = this.px_x + this.sprite.y = this.px_y } /** empty */