From b10f8d90695cc14f3db2aff139d7b8f4c22bff91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Sun, 5 Apr 2020 16:20:53 +0200 Subject: [PATCH] Loading first sprite --- .../resources/characters/pipoya/Male 01-1.png | Bin 0 -> 3488 bytes front/src/GameScene.ts | 39 ++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 front/dist/resources/characters/pipoya/Male 01-1.png diff --git a/front/dist/resources/characters/pipoya/Male 01-1.png b/front/dist/resources/characters/pipoya/Male 01-1.png new file mode 100644 index 0000000000000000000000000000000000000000..d4c12b28e9b1821c5dbad942c1d951c950ea6707 GIT binary patch literal 3488 zcmW-kc{tSF8^+JfFf(>)L>NX{voB#3O*08m*es-!UER;}#Bm48(7b!oe^@ijx26_iAJM*u@>pyb62%A{K3B4HJi+;^Gv7X) zQIQOE3PwJ{QRJO6`o%u(9Vh4O46}=4>pe=W?#L$Ug~;hIJ#KfC&;M8$$qwy_?CF}T z|8YdG9VTCsVhZoSsI>!S#eum){Hge#joi$vC3ni46*T;DY zRseUzhl1w$eEQnWL_UZHD7F%*`bZx=K`M!qCfp4#K!IPkyr1Q)OtVARixGL%z2A87 zPe@u^Lj-en`zT+?#;?GtUXSRgqwM`L!NvoOfx?2Kt!`M~7knmP;?khcqtWe@ux31R zvl!O52c%(m$MQX!s0u$S^4nhL+b#3x8a2@6OWv zPkMQ7l-Im5hz87_yv>gvKUUxDZKA|(f6NSCle-#Mr_361)#a&q(S!%3sIZr7?`OTK zB66lO!%bVQPUSK6!K~p>Zo}v5-|5}lpO@nFK-dAF^@xVJE0Q;r<2FXto0silQ~ZPC zBtSvlezL7kQ0&f>_P(>GjilA)MVa-oxnN-sHV|mKUto5$bIMY*%GPk&{3VSma!<=s z6AnGUyKJRCk^f**cVEEAhy2n0^bIb<IkR`kpeAS?z7wTU~o?SD?OEhj@RrlKwK5II>wemxr_1)!aK>N^5 zA@KQ_G7#)-HDuHoi?h|3*$gvQ_2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VJC=&ZSQ6>3CSDW=uf^1|cw~}uQCRz3T8Nxw6*dHCvu%q&6AM;#! zQNyV|JjYF8OGVW4&nO}JEi3^sSXI`r=|VZv0r-#O462=nxN)HmD-rY;{Uy literal 0 HcmV?d00001 diff --git a/front/src/GameScene.ts b/front/src/GameScene.ts index 9a432449..b8723574 100644 --- a/front/src/GameScene.ts +++ b/front/src/GameScene.ts @@ -10,6 +10,10 @@ export class GameScene extends Phaser.Scene { preload(): void { this.load.image('tiles', 'maps/tiles.png'); this.load.tilemapTiledJSON('map', 'maps/map2.json'); + this.load.spritesheet('player', + 'resources/characters/pipoya/Male 01-1.png', + { frameWidth: 32, frameHeight: 32 } + ); } init(): void { @@ -22,6 +26,41 @@ export class GameScene extends Phaser.Scene { let bottomLayer = mappy.createStaticLayer("Calque 1", [terrain], 0, 0); let topLayer = mappy.createStaticLayer("Calque 2", [terrain], 0, 0); + // Let's manage animations of the player + this.anims.create({ + key: 'down', + frames: this.anims.generateFrameNumbers('player', { start: 0, end: 3 }), + frameRate: 10, + repeat: -1 + }); + + this.anims.create({ + key: 'left', + frames: this.anims.generateFrameNumbers('player', { start: 4, end: 8 }), + frameRate: 10, + repeat: -1 + }); + + this.anims.create({ + key: 'right', + frames: this.anims.generateFrameNumbers('player', { start: 9, end: 12 }), + frameRate: 10, + repeat: -1 + }); + + this.anims.create({ + key: 'up', + frames: this.anims.generateFrameNumbers('player', { start: 13, end: 16 }), + frameRate: 10, + repeat: -1 + }); + + //let player = this.add.sprite(450, 450, 'player'); + //player.anims.play('down'); + //player.setBounce(0.2); + //player.setCollideWorldBounds(true); + + } private angle: number = 0;