Skip to content

Commit

Permalink
chore: Updates the example/main.ts with the new type, adds a todo.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Bjeaurn committed Sep 29, 2019
1 parent b6e6e7b commit a536b91
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 15 deletions.
12 changes: 12 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## Ideas for Gine 5

- Colission detection out of the box
- Map utilities (what exactly?!)
- Entity basics
- AI basics
- DevTools
- CLI


Type assets!

30 changes: 15 additions & 15 deletions example/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
import { Config, DEFAULT_CONFIG, Gine, IConfigArguments, Scene, SpriteOptions } from 'gine'
import { BasicAsset, Config, DEFAULT_CONFIG, Gine, IConfigArguments, Scene, SpriteOptions } from 'gine'
import { filter } from 'rxjs/operators'

import { LoadingScene } from './scenes/loading'
import { MainScene } from './scenes/main'

const cfg: Config = new Config(
document.querySelector('#game') as HTMLCanvasElement,
Object.assign(DEFAULT_CONFIG, {
width: 600,
height: 400,
tickRate: 120
} as IConfigArguments)
document.querySelector('#game') as HTMLCanvasElement,
Object.assign(DEFAULT_CONFIG, {
width: 600,
height: 400,
tickRate: 120,
} as IConfigArguments)
)

const game = new Gine(cfg)

const assets: any[] = [{ name: 'logo', src: 'logo.png' }]
const assets: BasicAsset[] = [{ name: 'logo', src: 'logo.png' }]
assets.forEach(d => {
Gine.store.image(d.name, d.src)
Gine.store.image(d.name, d.src)
})
Gine.store.sprite('player', 'spritesheet-example.png', {
widthPerImage: 64,
heightPerImage: 64,
imagesPerRow: 5,
numberOfFrames: 9,
ticksPerFrame: 24
} as SpriteOptions)
ticksPerFrame: 24,
} as SpriteOptions)

const loadingScene = new LoadingScene()
game.changeScene(loadingScene)
Expand All @@ -36,9 +36,9 @@ Gine.keyboard.key$.subscribe()
Gine.mouse.mouse$.subscribe()

Gine.events
.pipe(filter(ev => ev === Scene.DESTROY_CURRENT_SCENE))
.subscribe(ev => {
game.changeScene(mainScene)
})
.pipe(filter(ev => ev === Scene.DESTROY_CURRENT_SCENE))
.subscribe(ev => {
game.changeScene(mainScene)
})

Gine.events.subscribe(ev => console.log(ev))

0 comments on commit a536b91

Please sign in to comment.