mirror of
https://github.com/Aviortheking/games.git
synced 2025-06-09 13:19:54 +00:00
Fixed compilation errors
Signed-off-by: Avior <florian.bouillon@delta-wings.net>
This commit is contained in:
parent
7384ffc5b7
commit
04b3879946
@ -1,5 +1,5 @@
|
|||||||
/* eslint-disable max-classes-per-file */
|
/* eslint-disable max-classes-per-file */
|
||||||
import GameEngine, { Component2D, ComponentState, Scene, SoundManager } from 'GameEngine'
|
import { Component2D, ComponentState, SoundManager } from 'GameEngine'
|
||||||
|
|
||||||
const globalState: {
|
const globalState: {
|
||||||
playerTurn: 'X' | 'O'
|
playerTurn: 'X' | 'O'
|
||||||
@ -17,7 +17,7 @@ const globalState: {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
class Item extends Component2D {
|
export class Item extends Component2D {
|
||||||
|
|
||||||
public size = {
|
public size = {
|
||||||
width: .9,
|
width: .9,
|
||||||
@ -126,7 +126,7 @@ class Item extends Component2D {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Line extends Component2D {
|
export class Line extends Component2D {
|
||||||
|
|
||||||
public constructor(direction: number, index: number) {
|
public constructor(direction: number, index: number) {
|
||||||
super()
|
super()
|
||||||
@ -145,17 +145,3 @@ class Line extends Component2D {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const ge = new GameEngine('#test', {
|
|
||||||
caseCount: 3,
|
|
||||||
background: 'blue'
|
|
||||||
})
|
|
||||||
const scene = new Scene('TicTacToe')
|
|
||||||
scene.addComponent(
|
|
||||||
...Array.from(new Array(2)).map((_, index) => new Line(0, index)),
|
|
||||||
...Array.from(new Array(2)).map((_, index) => new Line(1, index)),
|
|
||||||
...Array.from(new Array(9)).map((_, index) => new Item(index)),
|
|
||||||
)
|
|
||||||
|
|
||||||
ge.start()
|
|
||||||
ge.setScene(scene)
|
|
@ -1,9 +1,22 @@
|
|||||||
import { Text, Link } from '@dzeio/components'
|
import { Text, Link } from '@dzeio/components'
|
||||||
|
import GameEngine, { Scene } from 'GameEngine'
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
import { Item, Line } from '../../games/tictactoe'
|
||||||
export default class Snake extends React.PureComponent {
|
export default class Snake extends React.PureComponent {
|
||||||
public async componentDidMount() {
|
public async componentDidMount() {
|
||||||
await import('./Game')
|
const ge = new GameEngine('#test', {
|
||||||
|
caseCount: 3,
|
||||||
|
background: 'blue'
|
||||||
|
})
|
||||||
|
const scene = new Scene('TicTacToe')
|
||||||
|
scene.addComponent(
|
||||||
|
...Array.from(new Array(2)).map((_, index) => new Line(0, index)),
|
||||||
|
...Array.from(new Array(2)).map((_, index) => new Line(1, index)),
|
||||||
|
...Array.from(new Array(9)).map((_, index) => new Item(index)),
|
||||||
|
)
|
||||||
|
|
||||||
|
ge.start()
|
||||||
|
ge.setScene(scene)
|
||||||
}
|
}
|
||||||
public render = () => (
|
public render = () => (
|
||||||
<>
|
<>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user