Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
FogNetwork
GitHub Repository: FogNetwork/Tsunami
Path: blob/main/public/games/files/gopher-kart/js/app.js
1036 views
1
// var mainState = {
2
// preload: function () {
3
// game.load.spritesheet('car', '../assets/gopher-drive-loop.png', 63, 59, 2);
4
// game.load.image('railBot', '../assets/bottom-rail.png');
5
// game.load.image('road', '../assets/road-tile.png');
6
// game.stage.smoothed = false;
7
// },
8
//
9
// create: function () {
10
// game.stage.backgroundColor = '#72c5cf';
11
//
12
// //1st num indicates the starting x tilePosition
13
// //2nd num indicates the starting y tilePosition
14
// //3rd num indicates the x (length) of repetition
15
// //4th num indicates the y (height) of repetition
16
// this.railBot = game.add.tileSprite(0, 385, 600, 0, 'railBot');
17
//
18
// game.physics.startSystem(Phaser.Physics.ARCADE);
19
//
20
// this.car = game.add.sprite(30, 280, "car");
21
//
22
// this.car.animations.add('drive', [0,1], 8, true);
23
//
24
// this.car.animations.play('drive');
25
//
26
// // this.car = game.add.sprite(30, 280, 'car');
27
//
28
// this.physics.arcade.enable(this.car);
29
//
30
// // this.car.anchor.setTo(-0.2, 0.5);
31
//
32
// this.car.body.collideWorldBounds = true;
33
//
34
// cursors = game.input.keyboard.createCursorKeys();
35
//
36
// // this.timer = game.time.events.loop(100, this.addRowOfRoads, this);
37
//
38
// this.road = game.add.group();
39
// },
40
//
41
// update: function () {
42
// this.railBot.tilePosition.x = 0.5;
43
//
44
// this.car.body.velocity.x = 0;
45
//
46
// if(cursors.right.isDown){
47
// this.car.body.velocity.x = 100;
48
// }
49
//
50
// else if (cursors.left.isDown){
51
// this.car.body.velocity.x = -300;
52
// }
53
//
54
// else if (cursors.right.isDown && this.car.body.y < this.window) {
55
// this.car.body.velocity.x = 0;
56
// }
57
// },
58
//
59
// addOneRoad: function(x, y){
60
// var road = game.add.sprite(x, y, 'road');
61
//
62
// this.road.add(road);
63
//
64
// game.physics.arcade.enable(road);
65
//
66
// road.body.velocity.x = -300;
67
//
68
// road.checkWorldBounds = true;
69
// road.outOfBoundsKill = true;
70
// },
71
//
72
// addRowOfRoads: function(){
73
// this.addOneRoad(600, 220);
74
// },
75
//
76
// };
77
//
78
// var game = new Phaser.Game(600, 432, Phaser.AUTO, 'ld29', null, false, false);
79
//
80
// game.state.add('main', mainState);
81
//
82
// game.state.start('main');
83
84