master
parent
4b3d7aad80
commit
c56d7e24db
@ -0,0 +1,2 @@
|
||||
.idea
|
||||
node_modules
|
@ -0,0 +1,41 @@
|
||||
module.exports = function (grunt) {
|
||||
grunt.initConfig({
|
||||
copy: {
|
||||
main: {
|
||||
files: [
|
||||
{expand: false, src: ['node_modules/jquery/dist/jquery.min.js'], dest: 'public/js/jquery.min.js', filter: 'isFile'},
|
||||
{expand: false, src: ['node_modules/phaser/dist/phaser.min.js'], dest: 'public/js/phaser.min.js', filter: 'isFile'},
|
||||
],
|
||||
},
|
||||
},
|
||||
|
||||
uglify: {
|
||||
my_target: {
|
||||
files: {
|
||||
'public/js//app.min.js': ['src/js/*.js'],
|
||||
'public/js//class.min.js': ['src/js/classes/*.js']
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
cssmin: {
|
||||
options: {
|
||||
mergeIntoShorthands: false,
|
||||
roundingPrecision: -1
|
||||
},
|
||||
target: {
|
||||
files: {
|
||||
'public/css//app.min.css': ['src/css/*.css']
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
grunt.loadNpmTasks('grunt-contrib-copy');
|
||||
grunt.loadNpmTasks('grunt-contrib-uglify-es');
|
||||
grunt.loadNpmTasks('grunt-contrib-cssmin');
|
||||
|
||||
grunt.registerTask('cp', ['copy']);
|
||||
grunt.registerTask('ugl', ['uglify', 'cssmin']);
|
||||
grunt.registerTask('default', ['cp', 'ugl']);
|
||||
}
|
After Width: | Height: | Size: 2.5 MiB |
After Width: | Height: | Size: 30 KiB |
After Width: | Height: | Size: 8.1 KiB |
Binary file not shown.
@ -0,0 +1,19 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Waria</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
|
||||
<link href="public/css/app.min.css" rel="stylesheet" type="text/css">
|
||||
<script src="public/js/phaser.min.js"></script>
|
||||
<script src="public/js/jquery.min.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Allerta+Stencil" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
</body>
|
||||
<div id='game'></div>
|
||||
<script src="public/js/class.min.js"></script>
|
||||
<script src="public/js/app.min.js"></script>
|
||||
</html>
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "waria",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "/index.html",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "Clément Maisonhaute",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"grunt": "^1.1.0",
|
||||
"jquery": "^3.5.1",
|
||||
"phaser": "^3.23.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"grunt-contrib-copy": "^1.0.0",
|
||||
"grunt-contrib-cssmin": "^3.0.0",
|
||||
"grunt-contrib-uglify-es": "^3.3.0"
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
body{background-color:#35363a}@font-face{font-family:stencil;src:url(../../fonts/Stencil_Regular.ttf)}
|
@ -0,0 +1 @@
|
||||
var EnemyBots=new Array(5),myself=new Robot(5,5);EnemyBots.push(new Robot(1,1)),console.log(myself.height);const WIDTH_WINDOW=$(document).width()-30,HEIGHT_WINDOW=$(document).height()-30;var config={type:Phaser.AUTO,width:WIDTH_WINDOW,height:HEIGHT_WINDOW,parent:"game",backgroundColor:"#35363A",scene:[Boot]},game=new Phaser.Game(config);
|
@ -0,0 +1 @@
|
||||
class Boot extends Phaser.Scene{constructor(){super("Boot"),this.active,this.currentScene}preload(){this.load.spritesheet("btn_play","assets/btnPlay.png",{frameWidth:650,frameHeight:170}),this.load.image("background","assets/background.png")}create(){this.add.image(0,0,"background").alpha=.1;this.add.text(WIDTH_WINDOW/2,HEIGHT_WINDOW/3,"WARIA",{font:"200px stencil",fill:"#e2e2e2"}).setOrigin(.5,.5);let t=this.add.sprite(WIDTH_WINDOW/2,HEIGHT_WINDOW/3*2,"btn_play").setInteractive();t.on("pointerout",()=>t.setFrame(0)),t.on("pointerover",()=>t.setFrame(1)),t.on("pointerdown",()=>this.clickPlay(t))}clickPlay(t){t.setFrame(2),console.log("Play")}}class Robot{constructor(t,e){this.height=t,this.width=e}}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,7 @@
|
||||
body{
|
||||
background-color: #35363A;
|
||||
}
|
||||
@font-face {
|
||||
font-family: stencil;
|
||||
src: url('../../fonts/Stencil_Regular.ttf');
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
var EnemyBots = new Array(5);
|
||||
var myself = new Robot(5,5);
|
||||
EnemyBots.push(new Robot(1,1));
|
||||
console.log(myself.height);
|
||||
const WIDTH_WINDOW = $(document).width() - 30;
|
||||
const HEIGHT_WINDOW = $(document).height() - 30;
|
||||
|
||||
var config = {
|
||||
type: Phaser.AUTO,
|
||||
width: WIDTH_WINDOW,
|
||||
height: HEIGHT_WINDOW,
|
||||
parent: 'game',
|
||||
backgroundColor: '#35363A',
|
||||
scene: [ Boot ]
|
||||
};
|
||||
|
||||
var game = new Phaser.Game(config);
|
@ -0,0 +1,28 @@
|
||||
class Boot extends Phaser.Scene {
|
||||
constructor() {
|
||||
super('Boot');
|
||||
this.active;
|
||||
this.currentScene;
|
||||
}
|
||||
preload () {
|
||||
this.load.spritesheet('btn_play', 'assets/btnPlay.png', { frameWidth: 650, frameHeight: 170 });
|
||||
this.load.image('background', 'assets/background.png');
|
||||
}
|
||||
|
||||
create () {
|
||||
this.add.image(0,0,'background').alpha = 0.1;
|
||||
|
||||
let style = { font : '200px stencil', fill: "#e2e2e2"};
|
||||
this.add.text(WIDTH_WINDOW / 2,HEIGHT_WINDOW / 3, "WARIA", style).setOrigin(0.5,0.5);
|
||||
let btn = this.add.sprite(WIDTH_WINDOW / 2,(HEIGHT_WINDOW / 3) * 2, 'btn_play').setInteractive();
|
||||
//btn.setFrame(0);
|
||||
btn.on('pointerout', () => btn.setFrame(0));
|
||||
btn.on('pointerover', () => btn.setFrame(1));
|
||||
btn.on('pointerdown', () => this.clickPlay(btn));
|
||||
}
|
||||
|
||||
clickPlay (btn) {
|
||||
btn.setFrame(2);
|
||||
console.log("Play");
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
class Robot {
|
||||
constructor(height, width) {
|
||||
this.height = height;
|
||||
this.width = width;
|
||||
}
|
||||
}
|
Loading…
Reference in new issue