-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
88e7a50
commit 3ed0158
Showing
10 changed files
with
199 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"modelVersion":2,"piskel":{"name":"Quadrados","description":"","fps":1,"height":32,"width":32,"layers":["{\"name\":\"Layer 1\",\"opacity\":1,\"frameCount\":9,\"chunks\":[{\"layout\":[[0],[1],[2],[3],[4],[5],[6],[7],[8]],\"base64PNG\":\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASAAAAAgCAYAAACy9KU0AAABfElEQVR4Xu3YwRGEQAwDQTv/D0Rsiij6M5eAWCG64PbubuBvd2H6DD38f3J9AWsvYM/ef34D8PGf56XP3wYQ7Z/vfwLIDiCAegOiC7QvIBNA+AYEUAAFkGugTzDX/Z/cJ1j/AdkF9gmG+7fxARRAdoEBhPu38QEUQHaBAYT7t/EBFEB2gQGE+7fxARRAdoEBhPu38QEUQHaBAYT7t/EBFEB2gQGE+7fxARRAdoEBhPu38QEUQHaBAYT7t/EBFEB2gQGE+7fxARRAdoEBhPu38QEUQHaBAYT7t/EBFEB2gQGE+7fxARRAdoEBhPu38QEUQHaBAYT7t/EBFEB2gQGE+7fxARRAdoEBhPu38QEUQHaBAYT7t/EBFEB2gQGE+7fxARRAdoEBhPu38QEUQHaBAYT7t/EBFEB2gQGE+7fxARRAdoEBhPu38QEUQHaBAYT7t/EBFEB2gQGE+7fxARRAdoEBhPu38QEUQHaBAYT7t/EBFEB2gQGE+7fxGqAPAY5WEFN5awYAAAAASUVORK5CYII=\"}]}"]}} |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
import { range, randomInt } from "201flaviosilva-utils"; | ||
|
||
// Player | ||
export function generatePlayerParticles(scene, player, x = 0, y = 0) { | ||
const PLAYER_SHIP_PARTICLES = scene.add.particles("PlayerShip"); | ||
const SQUARES_PARTICLES = scene.add.particles("SquaresParticles"); | ||
|
||
// Explosion | ||
const explosionEmitter = SQUARES_PARTICLES.createEmitter({ | ||
x: 0, y: 0, | ||
frame: range(0, 9), | ||
quantity: 1, | ||
frequency: -1, | ||
scale: { start: 0.5, end: 0 }, | ||
alpha: { start: 0.5, end: 0 }, | ||
speed: { min: 50, max: 150 }, | ||
rotate: { start: 0, end: 360 }, | ||
lifespan: { min: 250, max: 500 }, | ||
}); | ||
|
||
// Move Player Ship | ||
const moveEmitter1 = PLAYER_SHIP_PARTICLES.createEmitter({ | ||
x, y, | ||
follow: player, | ||
quantity: 1, | ||
speedX: { min: -500, max: -250 }, | ||
speedY: { min: -250, max: 250 }, | ||
scale: { start: 0.75, end: 0 }, | ||
alpha: { start: 0.5, end: 0 }, | ||
rotate: { start: 0, end: 360 }, | ||
lifespan: { min: 100, max: 500 }, | ||
}); | ||
|
||
// Move Sprite Sheet | ||
const moveEmitterBaseConfig = { | ||
x: 0, y: 0, | ||
moveToX: 0, | ||
alpha: { start: 0.5, end: 0.25 }, | ||
deathCallback: ({ x, y }) => { | ||
explosionEmitter.setPosition(x, y); | ||
explosionEmitter.explode(); | ||
}, | ||
} | ||
const moveEmitter2A = SQUARES_PARTICLES.createEmitter({ | ||
...moveEmitterBaseConfig, | ||
frame: range(0, 9), | ||
moveToY: { min: scene.scale.height / 2 - 150, max: scene.scale.height / 2 + 150 }, | ||
scale: { start: 0.5, end: 0.25 }, | ||
quantity: 4, | ||
}); | ||
const moveEmitter2B = SQUARES_PARTICLES.createEmitter({ | ||
...moveEmitterBaseConfig, | ||
frame: [3], | ||
moveToY: scene.scale.height / 2, | ||
scale: 0.5, | ||
quantity: 1, | ||
}); | ||
|
||
return { | ||
explosionEmitter, | ||
moveEmitter1, | ||
moveEmitter2A, | ||
moveEmitter2B, | ||
} | ||
} | ||
|
||
// Player Shoot | ||
export function generatePlayerShootParticles(scene, shoot, sprite, x = 0, y = 0) { | ||
const moveParticles = scene.add.particles(sprite); | ||
const moveParticlesEmitter = moveParticles.createEmitter({ | ||
x, y, | ||
follow: shoot, | ||
quantity: 1, | ||
speedX: { min: -500, max: -250 }, | ||
speedY: { min: -250, max: 250 }, | ||
scale: { start: 0.33, end: 0 }, | ||
alpha: { start: 0.5, end: 0 }, | ||
rotate: { start: 0, end: 360 }, | ||
lifespan: { min: 100, max: 500 }, | ||
}); | ||
|
||
// Kill | ||
const explosionParticles = scene.add.particles(sprite); | ||
const explosionParticlesEmitter = explosionParticles.createEmitter({ | ||
x, y, | ||
follow: shoot, | ||
quantity: 100, | ||
frequency: -1, | ||
scale: { start: 0.75, end: 0 }, | ||
alpha: { start: 0.75, end: 0 }, | ||
speed: { min: 50, max: 150 }, | ||
rotate: { start: 0, end: 360 }, | ||
lifespan: { min: 250, max: 750 }, | ||
}); | ||
|
||
return { | ||
moveParticles, moveParticlesEmitter, | ||
explosionParticles, explosionParticlesEmitter, | ||
}; | ||
} | ||
|
||
// Enemy | ||
export function generateEnemyParticles(scene, enemy, x = 0, y = 0) { | ||
const particles = scene.add.particles("Duke"); | ||
const particlesEmitter = particles.createEmitter({ | ||
x, y, | ||
follow: enemy, | ||
quantity: 1, | ||
frequency: 100, | ||
speedX: { min: 500, max: 250 }, | ||
speedY: { min: 250, max: -250 }, | ||
scale: { start: 0.5, end: 0 }, | ||
alpha: { start: 0.5, end: 0 }, | ||
rotate: { start: -90, end: randomInt(-360, 360) }, | ||
lifespan: { min: 100, max: 500 }, | ||
}); | ||
|
||
const deadParticlesEmitter = particles.createEmitter({ | ||
x, y, | ||
follow: enemy, | ||
quantity: 32, | ||
frequency: -1, | ||
scale: { start: 0.75, end: 0 }, | ||
alpha: { start: 0.75, end: 0 }, | ||
angle: { start: 0, end: 360, steps: 32 }, | ||
rotate: { start: -90, end: 270 }, | ||
tint: 0xff0000, | ||
speed: 200, | ||
lifespan: 500, | ||
}); | ||
|
||
|
||
return { | ||
particles, particlesEmitter, | ||
deadParticlesEmitter, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters