forked from carbonxx/noob-game
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
26 changed files
with
3,217 additions
and
103 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,9 @@ | ||
var express = require('express'); | ||
var router = express.Router(); | ||
|
||
// define the home page route | ||
router.get('/', function (req, res) { | ||
res.send(''); | ||
}); | ||
|
||
module.exports = router; |
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,16 @@ | ||
const mongoose = require('mongoose'); | ||
const schema = mongoose.Schema; | ||
|
||
const scoreSchema = new schema({ | ||
name: { | ||
type: String, | ||
required: true, | ||
}, | ||
score: { | ||
type: Number, | ||
required: true, | ||
} | ||
}); | ||
|
||
const score = mongoose.model('score', scoreSchema); | ||
module.exports = score; |
File renamed without changes
File renamed without changes
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Loading
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<style> | ||
#user-id { | ||
background-color: black; | ||
border: solid 5px #1e1f1e; | ||
padding: 0px 10px; | ||
color: white; | ||
} | ||
|
||
::placeholder { /* Chrome, Firefox, Opera, Safari 10.1+ */ | ||
color: #1e1f1e; | ||
opacity: 1; /* Firefox */ | ||
} | ||
|
||
:-ms-input-placeholder { /* Internet Explorer 10-11 */ | ||
color: #1e1f1e; | ||
} | ||
|
||
::-ms-input-placeholder { /* Microsoft Edge */ | ||
color: #1e1f1e; | ||
} | ||
</style> | ||
<input id="user-id" class="nameField" type="text" name="user-id" placeholder="enter your nick" style="font-size: 32px"> |
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,74 @@ | ||
class bootGame extends Phaser.Scene { | ||
constructor() { | ||
super("bootGame"); | ||
} | ||
|
||
preload() { | ||
// html to get user input | ||
// this.load.html('nameform', 'game/assets/user-input.html'); | ||
//images | ||
// main menu images | ||
this.load.image("title", "game/assets/title.png"); | ||
this.load.image("play", "game/assets/play.png"); | ||
this.load.image("htplay", "game/assets/htplay.png"); | ||
this.load.image("trophy", "game/assets/gleaderboard.png"); | ||
// game images | ||
this.load.image("bg", "game/assets/bg.png"); | ||
this.load.image("player", "game/assets/samurai.png"); | ||
//sprites | ||
this.load.spritesheet("ghost", "game/assets/ghost-sprite.png", { | ||
//ghosts | ||
frameWidth: 75, | ||
frameHeight: 75, | ||
}); | ||
this.load.spritesheet("candy", "game/assets/candy-sprite.png", { | ||
// candy | ||
frameWidth: 22, | ||
frameHeight: 22, | ||
}); | ||
|
||
// audio | ||
// this.load.audio("roblox-death-audio", "src/assets/roblox-death.mp3"); // "src/assets/roblox-death.ogg", | ||
} | ||
|
||
create() { | ||
|
||
///////////////////////////////////////// create animations | ||
////////////// main menu animations | ||
// play button | ||
this.anims.create({ | ||
key: "play", | ||
frames: this.anims.generateFrameNumbers("play", { | ||
start: 0, | ||
end: 1, | ||
}), | ||
frameRate: 5, | ||
repeat: -1, | ||
}); | ||
|
||
// this.add.text(20, 20, "Loading Game..."); | ||
this.anims.create({ | ||
key: "candy_beam", | ||
frames: this.anims.generateFrameNumbers("candy", { | ||
start: 0, | ||
end: 1, | ||
}), | ||
frameRate: 5, | ||
repeat: -1, | ||
}); | ||
// ghost walk animation | ||
this.anims.create({ | ||
key: "ghost_walk", | ||
frames: this.anims.generateFrameNumbers("ghost", { | ||
start: 0, | ||
end: 1, | ||
}), | ||
frameRate: 5, | ||
repeat: -1, | ||
}); | ||
|
||
// this.deathSound = this.sound.add("roblox-death-audio"); | ||
|
||
this.scene.start("mainMenu"); | ||
} | ||
} |
File renamed without changes.
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 |
---|---|---|
@@ -1,23 +1,23 @@ | ||
class mainMenu extends Phaser.Scene { | ||
constructor() { | ||
super("mainMenu"); | ||
} | ||
|
||
create() { | ||
this.add.text(20, 20, "Loading Game..."); | ||
// let playButton = this.physics.add.image(config.width/2, config.height/2, "player"); | ||
|
||
let playButton = this.add.rectangle(config.width/2, config.height/2, 250, 75, 0x2ECC71); | ||
// console.log(getCenter(playButton)); | ||
// playButton.setStrokeStyle(3, 0x2ECC71); | ||
console.log(playButton.x); | ||
|
||
this.add.text(playButton.x - playButton.width/4, playButton.y - playButton.height/4, "PLAY GAME"); | ||
|
||
playButton.setInteractive(); | ||
|
||
playButton.on('pointerdown', () => { | ||
this.scene.start("mainGame"); | ||
}); | ||
} | ||
class endScene extends Phaser.Scene { | ||
constructor() { | ||
super("endScene"); | ||
} | ||
|
||
create() { | ||
this.add.text(20, 20, "Game Over ahahahhaha NOOOB"); | ||
// let playButton = this.physics.add.image(config.width/2, config.height/2, "player"); | ||
|
||
let playButton = this.add.rectangle(config.width/2, config.height/2, 250, 75, 0x2ECC71); | ||
// console.log(getCenter(playButton)); | ||
// playButton.setStrokeStyle(3, 0x2ECC71); | ||
console.log(playButton.x); | ||
|
||
this.add.text(playButton.x - playButton.width/4, playButton.y - playButton.height/4, "PLAY AGAIN"); | ||
|
||
playButton.setInteractive(); | ||
|
||
playButton.on('pointerdown', () => { | ||
this.scene.start("mainGame"); | ||
}); | ||
} | ||
} |
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,66 @@ | ||
class mainMenu extends Phaser.Scene { | ||
constructor() { | ||
super("mainMenu"); | ||
} | ||
|
||
preload() { | ||
this.load.html('nameform', 'game/assets/user-input.html'); | ||
} | ||
|
||
create() { | ||
// this.add.text(20, 20, "Loading Game..."); | ||
// let playButton = this.physics.add.image(config.width/2, config.height/2, "player"); | ||
|
||
// game title | ||
this.add.image(600, 200, 'title'); | ||
|
||
// user input | ||
var element = this.add.dom(600, 330).createFromCache('nameform'); | ||
|
||
let htplay = this.add.image(400, 430, 'htplay').setInteractive(); | ||
let play = this.add.image(600, 430, 'play').setInteractive(); | ||
let leaderboard = this.add.image(800, 430, 'trophy').setInteractive(); | ||
|
||
play.on('pointerdown', () => { | ||
var userId = element.getChildByName('user-id'); | ||
this.scene.start("mainGame", {name: userId.value, score: 0}); | ||
}); | ||
|
||
// element.setPerspective(800); | ||
// element.addListener('click'); | ||
|
||
// element.on('click', function (event) { | ||
|
||
// if (event.target.name === 'playButton') | ||
// { | ||
// var inputText = this.getChildByName('nameField'); | ||
|
||
// // Have they entered anything? | ||
// if (inputText.value !== '') | ||
// { | ||
// // Turn off the click events | ||
// this.removeListener('click'); | ||
|
||
// // Hide the login element | ||
// this.setVisible(false); | ||
|
||
// // Populate the text with whatever they typed in | ||
// text.setText('Welcome ' + inputText.value); | ||
// } | ||
// else | ||
// { | ||
// // Flash the prompt | ||
// this.scene.tweens.add({ | ||
// targets: text, | ||
// alpha: 0.2, | ||
// duration: 250, | ||
// ease: 'Power3', | ||
// yoyo: true | ||
// }); | ||
// } | ||
// } | ||
|
||
// }); | ||
|
||
} | ||
} |
File renamed without changes.
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
Oops, something went wrong.