parent
778c1678a9
commit
697ef18407
18 changed files with 18992 additions and 7549 deletions
@ -0,0 +1,68 @@ |
||||
require('../../sass/board/troggle.scss'); |
||||
|
||||
import { Component } from 'react'; |
||||
|
||||
const troggleMoveTimers = []; |
||||
const troggleCreateTimers = []; |
||||
|
||||
export default class Troggles extends Component { |
||||
componentWillUnmount() { |
||||
// this.clearTroggleTimers();
|
||||
} |
||||
|
||||
// clearTroggleTimers() {
|
||||
// troggleMoveTimers.forEach((timer) => {
|
||||
// clearTimeout(timer);
|
||||
// });
|
||||
//
|
||||
// troggleCreateTimers.forEach((timer) => {
|
||||
// clearTimeout(timer);
|
||||
// });
|
||||
// };
|
||||
//
|
||||
// createTroggle(index) {
|
||||
// const newCoords = TroggleAI.create();
|
||||
// this.props.dispatch(TroggleActions.create(newCoords.x, newCoords.y));
|
||||
// troggleMoveTimers.push(setTimeout(this.moveTroggle.bind(this, index), 1000));
|
||||
// };
|
||||
//
|
||||
// createTroggles() {
|
||||
// const troggleCount = 3; //Math.min(Math.ceil(this.props.board.level / 2), 5);
|
||||
// for (let i = 0; i < troggleCount; i++) {
|
||||
// setTimeout(this.createTroggle.bind(this, i), (i + 1) * 5000);
|
||||
// }
|
||||
// };
|
||||
//
|
||||
// moveTroggle(index) {
|
||||
// const newCoords = TroggleAI.move(
|
||||
// this.props.troggles[index].x,
|
||||
// this.props.troggles[index].y,
|
||||
// this.props.muncher.x,
|
||||
// this.props.muncher.y
|
||||
// );
|
||||
//
|
||||
// if (newCoords.x === this.props.muncher.x && newCoords.y === this.props.muncher.y) {
|
||||
// this.props.dispatch(MessageActions.show("You've been eaten by a troggle!"));
|
||||
// this.props.dispatch(TroggleActions.clearAll());
|
||||
// }
|
||||
// else {
|
||||
// this.props.dispatch(TroggleActions.move(index, newCoords.x, newCoords.y));
|
||||
// clearTimeout(troggleMoveTimers[index]);
|
||||
// troggleMoveTimers[index] = setTimeout(this.moveTroggle.bind(this, index), 1000);
|
||||
// }
|
||||
// };
|
||||
|
||||
render() { |
||||
const classname = ['troggle', 'x' + this.props.x, 'y' + this.props.y]; |
||||
|
||||
// const troggleElements = [];
|
||||
// for (let i = 0; i < troggles.length; i++) {
|
||||
// troggleElements[i] = <Troggle x={troggles[i].x} y={troggles[i].y} key={i} />;
|
||||
// }
|
||||
// {troggleElements}
|
||||
|
||||
return ( |
||||
<div className={classname.join(' ')}></div> |
||||
); |
||||
}; |
||||
}; |
@ -1,6 +1,6 @@ |
||||
import { SETTINGS } from '../App'; |
||||
|
||||
const TroggleAI = { |
||||
const TroggleLogic = { |
||||
move: function(currX, currY, muncherX, muncherY) { |
||||
// Randomize movement with boolean flags.
|
||||
const moveToAttack = Boolean(Math.round(Math.random())); |
@ -1,3 +1,5 @@ |
||||
import { dispatch } from 'redux'; |
||||
|
||||
const validate = function(value, level) { |
||||
return ((value || -1) % (level + 2) === 0); |
||||
}; |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,42 @@ |
||||
/** |
||||
* ReactDOM v0.14.7 |
||||
* |
||||
* Copyright 2013-2015, Facebook, Inc. |
||||
* All rights reserved. |
||||
* |
||||
* This source code is licensed under the BSD-style license found in the |
||||
* LICENSE file in the root directory of this source tree. An additional grant |
||||
* of patent rights can be found in the PATENTS file in the same directory. |
||||
* |
||||
*/ |
||||
// Based off https://github.com/ForbesLindesay/umd/blob/master/template.js
|
||||
;(function(f) { |
||||
// CommonJS
|
||||
if (typeof exports === "object" && typeof module !== "undefined") { |
||||
module.exports = f(require('react')); |
||||
|
||||
// RequireJS
|
||||
} else if (typeof define === "function" && define.amd) { |
||||
define(['react'], f); |
||||
|
||||
// <script>
|
||||
} else { |
||||
var g; |
||||
if (typeof window !== "undefined") { |
||||
g = window; |
||||
} else if (typeof global !== "undefined") { |
||||
g = global; |
||||
} else if (typeof self !== "undefined") { |
||||
g = self; |
||||
} else { |
||||
// works providing we're not in "use strict";
|
||||
// needed for Java 8 Nashorn
|
||||
// see https://github.com/facebook/react/issues/3037
|
||||
g = this; |
||||
} |
||||
g.ReactDOM = f(g.React); |
||||
} |
||||
|
||||
})(function(React) { |
||||
return React.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; |
||||
}); |
@ -0,0 +1,9 @@ |
||||
var express = require('express'); |
||||
var app = express(); |
||||
|
||||
app.set('port', (process.env.PORT || 3000)) |
||||
app.use(express.static(__dirname)); |
||||
|
||||
app.listen(app.get('port'), function() { |
||||
console.log('Listening on localhost:' + app.get('port')); |
||||
}); |
@ -0,0 +1 @@ |
||||
.scorebar{font-size:0;height:70px;line-height:50px;margin:0 auto;width:600px}.scorebar .item{display:inline-block;font-size:13px;height:70px;line-height:70px;vertical-align:top}.scorebar .current-score{width:30%}.scorebar .high-score{text-align:center;width:40%}.scorebar .lives{text-align:right;width:30%}.scorebar .life{background:lime;display:inline-block;height:36px;margin-left:10px;vertical-align:middle;width:36px}.titlebar{font-size:13px;height:40px;line-height:40px;text-align:center}.grid{height:500px;overflow:hidden;position:relative;width:600px;z-index:0}.grid .cell{border:1px solid purple;height:100px;line-height:100px;position:absolute;text-align:center;width:100px}.message{background:#fff;border:1px solid #000;font-size:14px;line-height:40px;margin:150px 5%;padding:30px;position:absolute;text-align:center;width:90%;z-index:1000}.message,.message *{cursor:default}.message.hidden{opacity:0}.muncher{background:aqua;height:100px;margin-top:110px;opacity:.5;position:absolute;width:100px}.muncher.active{border:10px solid purple}.troggle{background:crimson;height:100px;margin-top:110px;opacity:.5;position:absolute;width:100px}.board{margin:0 auto;position:relative;width:600px}.board .x-1{left:-100px}.board .y-1{top:-100px}.board .x0{left:0}.board .y0{top:0}.board .x1{left:100px}.board .y1{top:100px}.board .x2{left:200px}.board .y2{top:200px}.board .x3{left:300px}.board .y3{top:300px}.board .x4{left:400px}.board .y4{top:400px}.board .x5{left:500px}.board .y5{top:500px}.board .x6{left:600px}.board .y6{top:600px}.board .x7{left:700px}.board .y7{top:700px}.highscores{font-size:0}.highscores .entry{font-size:16px;line-height:40px}.highscores .rank{display:inline-block;text-align:left;width:50px}.highscores .initials{display:inline-block;width:100px}.highscores .score{display:inline-block;text-align:right;width:200px}.welcome{padding:20px;text-align:center}.welcome img{width:350px}.welcome .highscores{margin:0 auto;width:350px}.welcome .newgame{margin:20px 0;transition:opacity .1s ease}.welcome .newgame.hidden{opacity:.5}*{box-sizing:border-box;font-family:Emulogic;margin:0;outline:none;padding:0} |
Loading…
Reference in new issue