feat: card portrait images loaded from public/cards/
This commit is contained in:
1 parent
b46cb707cd
commit
60b545c42d
14 files changed
+95
-75
No files matched your search
@@ -1,29 +1,45 @@
|
||||
import Phaser from 'phaser'
|
||||
|
||||
// Correspondance id personnage → fichier image
|
||||
const CARD_IMAGES = [
|
||||
{ id: 'queen', file: 'reine.png' },
|
||||
{ id: 'prince', file: 'prince.png' },
|
||||
{ id: 'butcher', file: 'boucher.png' },
|
||||
{ id: 'doctor', file: 'medecin.png' },
|
||||
{ id: 'apothecary', file: 'apoticaire.png'},
|
||||
{ id: 'jester', file: 'fou_du_roi.png'},
|
||||
{ id: 'assassin', file: 'assassin.png' },
|
||||
{ id: 'peasant', file: 'paysan.png' },
|
||||
{ id: 'executioner', file: 'bourreau.png' },
|
||||
{ id: 'knight', file: 'chevalier.png' },
|
||||
{ id: 'merchant', file: 'marchand.png' },
|
||||
{ id: 'bishop', file: 'eveque.png' }
|
||||
]
|
||||
|
||||
export class BootScene extends Phaser.Scene {
|
||||
constructor() {
|
||||
super('BootScene')
|
||||
}
|
||||
|
||||
preload() {
|
||||
// Créer des textures procédurales pour les cartes
|
||||
const graphics = this.add.graphics()
|
||||
// Charger les images des 12 personnages
|
||||
CARD_IMAGES.forEach(({ id, file }) => {
|
||||
this.load.image(`card-${id}`, `/cards/${file}`)
|
||||
})
|
||||
|
||||
// Fond de carte
|
||||
graphics.fillStyle(0x2a1500)
|
||||
graphics.fillRoundedRect(0, 0, 120, 180, 10)
|
||||
graphics.lineStyle(2, 0xd4a732)
|
||||
graphics.strokeRoundedRect(0, 0, 120, 180, 10)
|
||||
graphics.generateTexture('card-back', 120, 180)
|
||||
graphics.clear()
|
||||
// Barre de chargement simple
|
||||
const { width, height } = this.scale
|
||||
const bar = this.add.graphics()
|
||||
|
||||
// Carte face
|
||||
graphics.fillStyle(0x3a2010)
|
||||
graphics.fillRoundedRect(0, 0, 120, 180, 10)
|
||||
graphics.lineStyle(2, 0xd4a732)
|
||||
graphics.strokeRoundedRect(0, 0, 120, 180, 10)
|
||||
graphics.generateTexture('card-front', 120, 180)
|
||||
graphics.destroy()
|
||||
this.load.on('progress', (v) => {
|
||||
bar.clear()
|
||||
bar.fillStyle(0x1a0a00)
|
||||
bar.fillRect(width / 2 - 150, height / 2 - 10, 300, 20)
|
||||
bar.fillStyle(0xd4a732)
|
||||
bar.fillRect(width / 2 - 150, height / 2 - 10, 300 * v, 20)
|
||||
})
|
||||
|
||||
this.load.on('complete', () => bar.destroy())
|
||||
}
|
||||
|
||||
create() {
|
||||
|
||||
Reference in new issue
Block a user