Skip to content

Commit

Permalink
update these files
Browse files Browse the repository at this point in the history
  • Loading branch information
omenking committed Jul 27, 2018
1 parent 492d4f1 commit 330d0ab
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 22 deletions.
2 changes: 1 addition & 1 deletion app/assets/assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
Binary file modified app/assets/images/playfield_vs_frame.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/assets/spritesheets/ints_large.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions spec/integration/online.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
48 changes: 29 additions & 19 deletions src/renderer/components/playfield_cursor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -301,6 +308,7 @@ export default class ComponentPlayfieldCursor {
}
}


get stage(){
return this.playfield.stage
}
Expand All @@ -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 */
Expand Down

0 comments on commit 330d0ab

Please sign in to comment.