Browse Source

faling scooters canvas fullscreen and random, needs sprites for other brands

master
dennisdebel 4 years ago
parent
commit
f70bddc9d9
  1. BIN
      graphics/falling-scooters/.DS_Store
  2. 29
      graphics/falling-scooters/assets/fruit-shapes.json
  3. BIN
      graphics/falling-scooters/assets/fruit-sprites.png
  4. 20
      graphics/falling-scooters/index.js
  5. 2
      graphics/falling-scooters/phaser.min.js

BIN
graphics/falling-scooters/.DS_Store

Binary file not shown.

29
graphics/falling-scooters/assets/fruit-shapes.json

@ -128,7 +128,7 @@
"type": "fromPhysicsEditor",
"label": "ground",
"isStatic": true,
"density": 0.10000000149011612,
"density": 0,
"restitution": 0,
"friction": 0.10000000149011612,
"frictionAir": 0.009999999776482582,
@ -143,32 +143,7 @@
"label": "",
"isSensor": false,
"vertices": [
[ { "x":380, "y":524 }, { "x":351, "y":561 }, { "x":444, "y":549 } ],
[ { "x":754, "y":524 }, { "x":725, "y":561 }, { "x":833, "y":557 } ],
[ { "x":159, "y":524 }, { "x":132, "y":530 }, { "x":166, "y":537 } ],
[ { "x":857, "y":511 }, { "x":852, "y":534 }, { "x":942, "y":535 }, { "x":932, "y":517 }, { "x":890, "y":500 } ],
[ { "x":973, "y":533 }, { "x":961, "y":543 }, { "x":1200, "y":626 }, { "x":987, "y":535 } ],
[ { "x":1077, "y":448 }, { "x":1041, "y":513 }, { "x":1200, "y":626 }, { "x":1116, "y":448 } ],
[ { "x":459, "y":526 }, { "x":444, "y":549 }, { "x":610, "y":566 }, { "x":508, "y":524 } ],
[ { "x":1200, "y":340 }, { "x":1110, "y":346 }, { "x":1130, "y":416 }, { "x":1200, "y":626 } ],
[ { "x":626, "y":545 }, { "x":610, "y":566 }, { "x":725, "y":561 }, { "x":675, "y":542 } ],
[ { "x":1102, "y":360 }, { "x":1104, "y":379 }, { "x":1130, "y":416 }, { "x":1110, "y":346 } ],
[ { "x":250, "y":547 }, { "x":240, "y":566 }, { "x":351, "y":561 }, { "x":301, "y":542 } ],
[ { "x":182, "y":537 }, { "x":166, "y":537 }, { "x":201, "y":553 } ],
[ { "x":91, "y":388 }, { "x":77, "y":358 }, { "x":59, "y":340 }, { "x":0, "y":340 }, { "x":0, "y":626 }, { "x":87, "y":423 } ],
[ { "x":852, "y":534 }, { "x":833, "y":557 }, { "x":961, "y":543 }, { "x":942, "y":535 } ],
[ { "x":997, "y":522 }, { "x":987, "y":535 }, { "x":1200, "y":626 }, { "x":1041, "y":513 } ],
[ { "x":104, "y":456 }, { "x":87, "y":423 }, { "x":0, "y":626 }, { "x":106, "y":515 } ],
[ { "x":166, "y":537 }, { "x":132, "y":530 }, { "x":0, "y":626 }, { "x":201, "y":553 } ],
[ { "x":444, "y":549 }, { "x":351, "y":561 }, { "x":610, "y":566 } ],
[ { "x":106, "y":515 }, { "x":0, "y":626 }, { "x":113, "y":522 } ],
[ { "x":113, "y":522 }, { "x":0, "y":626 }, { "x":132, "y":530 } ],
[ { "x":201, "y":553 }, { "x":0, "y":626 }, { "x":240, "y":566 } ],
[ { "x":0, "y":626 }, { "x":1200, "y":626 }, { "x":610, "y":566 }, { "x":351, "y":561 }, { "x":240, "y":566 } ],
[ { "x":610, "y":566 }, { "x":1200, "y":626 }, { "x":833, "y":557 } ],
[ { "x":833, "y":557 }, { "x":1200, "y":626 }, { "x":961, "y":543 } ],
[ { "x":1116, "y":448 }, { "x":1200, "y":626 }, { "x":1130, "y":416 } ]
]
]
}
]
}

BIN
graphics/falling-scooters/assets/fruit-sprites.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 KiB

After

Width:  |  Height:  |  Size: 68 KiB

20
graphics/falling-scooters/index.js

@ -5,11 +5,14 @@
var config = {
type: Phaser.AUTO,
width: 1200,
height: 600,
transparent: true,
scale: {
mode: Phaser.Scale.FIT,
parent: 'game',
autoCenter: Phaser.Scale.CENTER_BOTH,
width: 1024,
height: 600
}, transparent: true,
backgroundColor: 0xffffff,
parent: 'game',
scene: {
preload: preload,
create: create
@ -50,7 +53,14 @@ function create() {
this.matter.add.sprite(360, 50, 'sheet', 'orange', {shape: shapes.orange});
this.matter.add.sprite(400, 250, 'sheet', 'cherries', {shape: shapes.cherries});
var sprites = ['crate','banana','orange','cherries']; //array to choose random sprite from
this.input.on('pointerdown', function (pointer) {
this.matter.add.sprite(pointer.x, pointer.y, 'sheet', 'banana', {shape: shapes.banana});
this.matter.add.sprite(pointer.x, pointer.y, 'sheet', sprites[getRandomInt(4)], {shape: shapes.banana});
}, this);
}
function getRandomInt(max) {
return Math.floor(Math.random() * Math.floor(max));
}

2
graphics/falling-scooters/phaser.min.js

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save