Yes it works!

This commit is contained in:
Jörn-Michael Miehe 2018-11-29 12:27:26 +01:00
parent 9f0d13c475
commit d464a9e29d
11 changed files with 72 additions and 92 deletions

70
src/game.coffee Normal file
View file

@ -0,0 +1,70 @@
# libs
window.$ = require('jquery')
# on load
$ ->
# libs requiring full DOM
require 'craftyjs/dist/crafty'
# style sheet
require './style/custom.scss'
# fftcg libs
require './game/config.coffee'
require './game/components/Card.coffee'
require './game/scenes/Battle.coffee'
# init Socket.IO
socket = io()
# init CraftyJS framework
Crafty.init()
# Load base scene
Crafty.scene "Battle"
# Testing some entities
Crafty.sprite 480, 670, '//www.fftcgmognet.com/images/cards/hd/1/1/107.jpg',
shantotto: [
0
0
]
backups = [
Crafty.e 'shantotto, AllyCard'
.attr {
card:
type: 'backup'
}
Crafty.e 'shantotto, AllyCard'
.attr {
card:
type: 'backup'
}
Crafty.e 'shantotto, AllyCard'
.attr {
card:
type: 'backup'
}
]
Crafty 'AllyCard'
.each (index) ->
switch @card.type
when 'backup'
@trigger 'Place',
x: CONF.coord.x.main + index * CONF.coord.x.step
y: CONF.coord.y.bkup
return
Crafty.e 'shantotto, EnemyCard'
.trigger 'Place',
x: 900
y: 0
return

View file

@ -1,11 +0,0 @@
// libs
const $ = require('jquery')
// style sheet
require('./style/custom.scss')
// on load
$(() => {
require('craftyjs/dist/crafty.js')
require('./game/test_entities.coffee')
})

View file

@ -1,5 +1,3 @@
CONF = require '../config.coffee'
# intermediate config
bcConf = Crafty.clone CONF.bigcard

View file

@ -1,4 +1,3 @@
CONF = require '../config.coffee'
require './BigCard.coffee'
################

View file

@ -1,5 +1,3 @@
CONF = require '../config.coffee'
################
# Playmat
################

View file

@ -1,4 +1,4 @@
CONF =
window.CONF =
playmat:
w: 2000
@ -41,5 +41,3 @@ CONF =
deck: 408
dmg: 948
dmst: -51
module.exports = CONF

View file

@ -1,4 +1,3 @@
CONF = require '../config.coffee'
require '../components/Playmat.coffee'
Crafty.defineScene "Battle", ->

View file

@ -1,56 +0,0 @@
CONF = require './config.coffee'
require './components/Card.coffee'
require './scenes/Battle.coffee'
# init Socket.IO
socket = io()
# init CraftyJS framework
Crafty.init()
# Load base scene
Crafty.scene "Battle"
# Testing some entities
Crafty.sprite 480, 670, '//www.fftcgmognet.com/images/cards/hd/1/1/107.jpg',
shantotto: [
0
0
]
backups = [
Crafty.e 'shantotto, AllyCard'
.attr {
card:
type: 'backup'
}
Crafty.e 'shantotto, AllyCard'
.attr {
card:
type: 'backup'
}
Crafty.e 'shantotto, AllyCard'
.attr {
card:
type: 'backup'
}
]
Crafty 'AllyCard'
.each (index) ->
switch @card.type
when 'backup'
@trigger 'Place',
x: CONF.coord.x.main + index * CONF.coord.x.step
y: CONF.coord.y.bkup
return
Crafty.e 'shantotto, EnemyCard'
.trigger 'Place',
x: 900
y: 0

14
static/crafty-min.js vendored

File diff suppressed because one or more lines are too long

View file

@ -3,7 +3,6 @@
<head>
<title>Crafty Things</title>
<script src="/socket.io/socket.io.js"></script>
<script src="crafty-min.js"></script>
<script src="game.bundle.js"></script>
</head>
<body></body>

View file

@ -5,7 +5,7 @@ module.exports = {
entry: {
index: './src/index.js',
game: './src/game.js'
game: './src/game.coffee'
},
devtool: 'inline-source-map',