C .
ODE
G
AMELET
# TestFilePond A Test project for filepond. # FilePond (v1.8.8) A JavaScript library that can upload anything you throw at it, optimizes images for faster uploads, and offers a great, accessible, silky smooth user experience. ### Basic Usage Make sure to load the css before creating FilePond Apps. ```typescript CG.Base.linkCSSFile(CG.Base.getAppResourceFileUrl('[YourProjectCode.Alias]', 'react-filepond-0/filepond.min.css')) ``` Create FilePond App. ```typescript let app: FilePond.AppAPI = FilePond.create(); document.body.appendChild(app.element); ``` Create FilePond with existing element. ```typescript let app: FilePond.AppAPI = FilePond.create(document.getElementById('theIdOfTheInput')); ``` With React Component ```typescript export class FilePondComp extends React.Component { render() { return ( <div> <FilePond.FilePond allowMultiple={true} maxFiles={3}> </FilePond.FilePond> </div> ); } } ``` ### Demo Project - [TestPondFile](https://code.gamelet.com/edit/TestFilePond) ## References [Official Site](https://pqina.nl/filepond) This lib includes the following github repositories - [filepond](https://github.com/pqina/filepond) - [react-filepond](https://github.com/pqina/react-filepond) - [filepond-plugin-file-encode](https://github.com/pqina/filepond-plugin-file-encode) - [filepond-plugin-file-metadata](https://github.com/pqina/filepond-plugin-file-encode) - [filepond-plugin-file-poster](https://github.com/pqina/filepond-plugin-file-poster) - [filepond-plugin-file-rename](https://github.com/pqina/filepond-plugin-file-rename) - [filepond-plugin-file-validate-size](https://github.com/pqina/filepond-plugin-file-validate-size) - [filepond-plugin-file-validate-type](https://github.com/pqina/filepond-plugin-file-validate-type) - [filepond-plugin-image-crop](https://github.com/pqina/filepond-plugin-image-crop) - [filepond-plugin-image-exif-orientation](https://github.com/pqina/filepond-plugin-image-exif-orientation) - [filepond-plugin-image-preview](https://github.com/pqina/filepond-plugin-image-preview) - [filepond-plugin-image-resize](https://github.com/pqina/filepond-plugin-image-resize) - [filepond-plugin-image-transform](https://github.com/pqina/filepond-plugin-image-transform) - [filepond-plugin-image-validate-size](https://github.com/pqina/filepond-plugin-image-validate-size)
# Rapid 快速開發模組(by gamtable) 簡化一般常用的功能,讓用戶可以快速開發。 ## Why use Rapid? 為什麼要用Rapid呢? 有些人可能問:為什麼要用Rapid呢?</br> Rapid又有什麼好處呢?</br></br> Rapid把使用對象設在國中生,把功能的複雜的程度大量簡化,當您載入了Rapid,就可以很輕鬆地做出很多東西。</br> 一些很複雜的東西(比如是loadber、按鈕等等),在Base中都沒沒有提供,但Rapid不但提供了以上功能,我們還把功能整合、中文化。</br></br></br></br> <h3>學習程式?就是如此簡單。</h3> ## Start 開始使用 在使用模組之前,必須在右方的"加載模組"載入本模組。<br> 在編輯時,輸入 **CG.Rapid.**就可以使用,以下為例子: ```typescript export class App { constructor() { CG.Rapid.system.addResource('圖片1','圖片2','圖片3'); //加載資源 } } ``` **注意1:**本模組已事先載入Base的模組,用戶不必重新載入。<br> **注意2:**用戶可以在"討論"提出意見。開發本模組時是根據團隊團員不擅長之處開發,不一定可以涵蓋所有用戶。<br> **注意3:**後續版本會閞發類似光暈同人陣的環境,閞發者可以在OwnGame.ts找到所需函數(未開發完成,現階段使用並沒有效果)。 ## Tutorial 一般教學 檢查是不是用手機瀏覽 ```typescript export class App { constructor() { CG.Base.pixi.initialize(800,600); CG.Rapid.fillClr(0xFFFFFF); if (CG.Rapid.system.checkMobile() == true) { CG.Rapid.text('這是手機用戶',100,100) } else { CG.Rapid.text('這是電腦用戶',100,100) } } } export const APP: App = new App(); ``` 列出一段文字 ```typescript export class App { constructor() { CG.Base.pixi.initialize(800,600); CG.Rapid.fillClr(0xFFFFFF); CG.Rapid.text('列出一段文字',100,100); } } export const APP: App = new App(); ``` 放置圖片 ```typescript export class App { constructor() { CG.Rapid.system.addResource('圖片1'); //要先加載圖片 CG.Base.pixi.initialize(800,600); CG.Base.resourceManager.load(() => { let myImage = CG.Rapid.img('圖片1'); //放置圖片 CG.Base.pixi.root.removeChild(myImage); //移除圖片 }; } } ``` 放置按鈕 ```typescript export class App { constructor() { CG.Rapid.system.addResource('圖片1'); //要先加載圖片 CG.Base.resourceManager.load(() => { let newButton = CG.Rapid.GUI.button(10,10,'圖片1',() => { console.log('點下去就會say hi!'); }); //放置按鈕 CG.Base.pixi.root.removeChild(newButton); //移除按鈕 }; } } ``` ## Authors 作者 * **[gamtable](/dev/profile/gamtable)**
sprite: SpritesheetMovieClip; speed: number = 0.1; constructor() { this.sprite = CG.Base.resourceManager.createSpritesheetMovieClip('zombieGame.person'); this.sprite.pivot.set(this.sprite.width / 2, this.sprite.height / 2); this.sprite.position.set(CG.Base.pixi.stageWidth / 2, CG.Base.pixi.stageWidth - 100); CG.Base.pixi.root.addChild(this.sprite); this.sprite.scale.set(3, 3); CG.Base.addUpdateFunction(this, this.update); /* PIXI.keyboardManager.on('pressed', (key) => { if (key == PIXI.keyboard.Key.SPACE) { new Bullet(this.sprite.x, this.sprite.y - 30, 1); } });*/ } update(dt: number): void { let move: CG.Base.geom.Point = new CG.Base.geom.Point(0, 0); if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.RIGHT)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.D)) { move.x = 1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.LEFT)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.A)) { move.x = -1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.UP)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.W)) { move.y = -1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.DOWN)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.S)) { move.y = 1; } move.normalize(dt * this.speed); let edge: number = 20; let position: CG.Base.geom.Point = CG.Base.geom.Point.fromPIXIPoint(this.sprite.position); position.x = position.x + move.x; position.y = position.y + move.y; if (position.x < edge) { position.x = edge; } else if (position.x > CG.Base.pixi.stageWidth - edge) { position.x = CG.Base.pixi.stageWidth - edge; } edge = 30; if (position.y < edge) { position.y = edge; } else if (position.y > CG.Base.pixi.stageHeight - edge) { position.y = CG.Base.pixi.stageHeight - edge; } this.sprite.position.set(position.x, position.y); }sprite: SpritesheetMovieClip; speed: number = 0.1; constructor() { this.sprite = CG.Base.resourceManager.createSpritesheetMovieClip('zombieGame.person'); this.sprite.pivot.set(this.sprite.width / 2, this.sprite.height / 2); this.sprite.position.set(CG.Base.pixi.stageWidth / 2, CG.Base.pixi.stageWidth - 100); CG.Base.pixi.root.addChild(this.sprite); this.sprite.scale.set(3, 3); CG.Base.addUpdateFunction(this, this.update); /* PIXI.keyboardManager.on('pressed', (key) => { if (key == PIXI.keyboard.Key.SPACE) { new Bullet(this.sprite.x, this.sprite.y - 30, 1); } });*/ } update(dt: number): void { let move: CG.Base.geom.Point = new CG.Base.geom.Point(0, 0); if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.RIGHT)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.D)) { move.x = 1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.LEFT)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.A)) { move.x = -1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.UP)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.W)) { move.y = -1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.DOWN)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.S)) { move.y = 1; } move.normalize(dt * this.speed); let edge: number = 20; let position: CG.Base.geom.Point = CG.Base.geom.Point.fromPIXIPoint(this.sprite.position); position.x = position.x + move.x; position.y = position.y + move.y; if (position.x < edge) { position.x = edge; } else if (position.x > CG.Base.pixi.stageWidth - edge) { position.x = CG.Base.pixi.stageWidth - edge; } edge = 30; if (position.y < edge) { position.y = edge; } else if (position.y > CG.Base.pixi.stageHeight - edge) { position.y = CG.Base.pixi.stageHeight - edge; } this.sprite.position.set(position.x, position.y); }sprite: SpritesheetMovieClip; speed: number = 0.1; constructor() { this.sprite = CG.Base.resourceManager.createSpritesheetMovieClip('zombieGame.person'); this.sprite.pivot.set(this.sprite.width / 2, this.sprite.height / 2); this.sprite.position.set(CG.Base.pixi.stageWidth / 2, CG.Base.pixi.stageWidth - 100); CG.Base.pixi.root.addChild(this.sprite); this.sprite.scale.set(3, 3); CG.Base.addUpdateFunction(this, this.update); /* PIXI.keyboardManager.on('pressed', (key) => { if (key == PIXI.keyboard.Key.SPACE) { new Bullet(this.sprite.x, this.sprite.y - 30, 1); } });*/ } update(dt: number): void { let move: CG.Base.geom.Point = new CG.Base.geom.Point(0, 0); if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.RIGHT)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.D)) { move.x = 1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.LEFT)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.A)) { move.x = -1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.UP)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.W)) { move.y = -1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.DOWN)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.S)) { move.y = 1; } move.normalize(dt * this.speed); let edge: number = 20; let position: CG.Base.geom.Point = CG.Base.geom.Point.fromPIXIPoint(this.sprite.position); position.x = position.x + move.x; position.y = position.y + move.y; if (position.x < edge) { position.x = edge; } else if (position.x > CG.Base.pixi.stageWidth - edge) { position.x = CG.Base.pixi.stageWidth - edge; } edge = 30; if (position.y < edge) { position.y = edge; } else if (position.y > CG.Base.pixi.stageHeight - edge) { position.y = CG.Base.pixi.stageHeight - edge; } this.sprite.position.set(position.x, position.y); }sprite: SpritesheetMovieClip; speed: number = 0.1; constructor() { this.sprite = CG.Base.resourceManager.createSpritesheetMovieClip('zombieGame.person'); this.sprite.pivot.set(this.sprite.width / 2, this.sprite.height / 2); this.sprite.position.set(CG.Base.pixi.stageWidth / 2, CG.Base.pixi.stageWidth - 100); CG.Base.pixi.root.addChild(this.sprite); this.sprite.scale.set(3, 3); CG.Base.addUpdateFunction(this, this.update); /* PIXI.keyboardManager.on('pressed', (key) => { if (key == PIXI.keyboard.Key.SPACE) { new Bullet(this.sprite.x, this.sprite.y - 30, 1); } });*/ } update(dt: number): void { let move: CG.Base.geom.Point = new CG.Base.geom.Point(0, 0); if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.RIGHT)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.D)) { move.x = 1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.LEFT)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.A)) { move.x = -1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.UP)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.W)) { move.y = -1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.DOWN)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.S)) { move.y = 1; } move.normalize(dt * this.speed); let edge: number = 20; let position: CG.Base.geom.Point = CG.Base.geom.Point.fromPIXIPoint(this.sprite.position); position.x = position.x + move.x; position.y = position.y + move.y; if (position.x < edge) { position.x = edge; } else if (position.x > CG.Base.pixi.stageWidth - edge) { position.x = CG.Base.pixi.stageWidth - edge; } edge = 30; if (position.y < edge) { position.y = edge; } else if (position.y > CG.Base.pixi.stageHeight - edge) { position.y = CG.Base.pixi.stageHeight - edge; } this.sprite.position.set(position.x, position.y); }sprite: SpritesheetMovieClip; speed: number = 0.1; constructor() { this.sprite = CG.Base.resourceManager.createSpritesheetMovieClip('zombieGame.person'); this.sprite.pivot.set(this.sprite.width / 2, this.sprite.height / 2); this.sprite.position.set(CG.Base.pixi.stageWidth / 2, CG.Base.pixi.stageWidth - 100); CG.Base.pixi.root.addChild(this.sprite); this.sprite.scale.set(3, 3); CG.Base.addUpdateFunction(this, this.update); /* PIXI.keyboardManager.on('pressed', (key) => { if (key == PIXI.keyboard.Key.SPACE) { new Bullet(this.sprite.x, this.sprite.y - 30, 1); } });*/ } update(dt: number): void { let move: CG.Base.geom.Point = new CG.Base.geom.Point(0, 0); if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.RIGHT)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.D)) { move.x = 1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.LEFT)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.A)) { move.x = -1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.UP)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.W)) { move.y = -1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.DOWN)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.S)) { move.y = 1; } move.normalize(dt * this.speed); let edge: number = 20; let position: CG.Base.geom.Point = CG.Base.geom.Point.fromPIXIPoint(this.sprite.position); position.x = position.x + move.x; position.y = position.y + move.y; if (position.x < edge) { position.x = edge; } else if (position.x > CG.Base.pixi.stageWidth - edge) { position.x = CG.Base.pixi.stageWidth - edge; } edge = 30; if (position.y < edge) { position.y = edge; } else if (position.y > CG.Base.pixi.stageHeight - edge) { position.y = CG.Base.pixi.stageHeight - edge; } this.sprite.position.set(position.x, position.y); }sprite: SpritesheetMovieClip; speed: number = 0.1; constructor() { this.sprite = CG.Base.resourceManager.createSpritesheetMovieClip('zombieGame.person'); this.sprite.pivot.set(this.sprite.width / 2, this.sprite.height / 2); this.sprite.position.set(CG.Base.pixi.stageWidth / 2, CG.Base.pixi.stageWidth - 100); CG.Base.pixi.root.addChild(this.sprite); this.sprite.scale.set(3, 3); CG.Base.addUpdateFunction(this, this.update); /* PIXI.keyboardManager.on('pressed', (key) => { if (key == PIXI.keyboard.Key.SPACE) { new Bullet(this.sprite.x, this.sprite.y - 30, 1); } });*/ } update(dt: number): void { let move: CG.Base.geom.Point = new CG.Base.geom.Point(0, 0); if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.RIGHT)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.D)) { move.x = 1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.LEFT)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.A)) { move.x = -1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.UP)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.W)) { move.y = -1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.DOWN)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.S)) { move.y = 1; } move.normalize(dt * this.speed); let edge: number = 20; let position: CG.Base.geom.Point = CG.Base.geom.Point.fromPIXIPoint(this.sprite.position); position.x = position.x + move.x; position.y = position.y + move.y; if (position.x < edge) { position.x = edge; } else if (position.x > CG.Base.pixi.stageWidth - edge) { position.x = CG.Base.pixi.stageWidth - edge; } edge = 30; if (position.y < edge) { position.y = edge; } else if (position.y > CG.Base.pixi.stageHeight - edge) { position.y = CG.Base.pixi.stageHeight - edge; } this.sprite.position.set(position.x, position.y); }sprite: SpritesheetMovieClip; speed: number = 0.1; constructor() { this.sprite = CG.Base.resourceManager.createSpritesheetMovieClip('zombieGame.person'); this.sprite.pivot.set(this.sprite.width / 2, this.sprite.height / 2); this.sprite.position.set(CG.Base.pixi.stageWidth / 2, CG.Base.pixi.stageWidth - 100); CG.Base.pixi.root.addChild(this.sprite); this.sprite.scale.set(3, 3); CG.Base.addUpdateFunction(this, this.update); /* PIXI.keyboardManager.on('pressed', (key) => { if (key == PIXI.keyboard.Key.SPACE) { new Bullet(this.sprite.x, this.sprite.y - 30, 1); } });*/ } update(dt: number): void { let move: CG.Base.geom.Point = new CG.Base.geom.Point(0, 0); if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.RIGHT)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.D)) { move.x = 1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.LEFT)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.A)) { move.x = -1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.UP)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.W)) { move.y = -1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.DOWN)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.S)) { move.y = 1; } move.normalize(dt * this.speed); let edge: number = 20; let position: CG.Base.geom.Point = CG.Base.geom.Point.fromPIXIPoint(this.sprite.position); position.x = position.x + move.x; position.y = position.y + move.y; if (position.x < edge) { position.x = edge; } else if (position.x > CG.Base.pixi.stageWidth - edge) { position.x = CG.Base.pixi.stageWidth - edge; } edge = 30; if (position.y < edge) { position.y = edge; } else if (position.y > CG.Base.pixi.stageHeight - edge) { position.y = CG.Base.pixi.stageHeight - edge; } this.sprite.position.set(position.x, position.y); }sprite: SpritesheetMovieClip; speed: number = 0.1; constructor() { this.sprite = CG.Base.resourceManager.createSpritesheetMovieClip('zombieGame.person'); this.sprite.pivot.set(this.sprite.width / 2, this.sprite.height / 2); this.sprite.position.set(CG.Base.pixi.stageWidth / 2, CG.Base.pixi.stageWidth - 100); CG.Base.pixi.root.addChild(this.sprite); this.sprite.scale.set(3, 3); CG.Base.addUpdateFunction(this, this.update); /* PIXI.keyboardManager.on('pressed', (key) => { if (key == PIXI.keyboard.Key.SPACE) { new Bullet(this.sprite.x, this.sprite.y - 30, 1); } });*/ } update(dt: number): void { let move: CG.Base.geom.Point = new CG.Base.geom.Point(0, 0); if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.RIGHT)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.D)) { move.x = 1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.LEFT)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.A)) { move.x = -1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.UP)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.W)) { move.y = -1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.DOWN)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.S)) { move.y = 1; } move.normalize(dt * this.speed); let edge: number = 20; let position: CG.Base.geom.Point = CG.Base.geom.Point.fromPIXIPoint(this.sprite.position); position.x = position.x + move.x; position.y = position.y + move.y; if (position.x < edge) { position.x = edge; } else if (position.x > CG.Base.pixi.stageWidth - edge) { position.x = CG.Base.pixi.stageWidth - edge; } edge = 30; if (position.y < edge) { position.y = edge; } else if (position.y > CG.Base.pixi.stageHeight - edge) { position.y = CG.Base.pixi.stageHeight - edge; } this.sprite.position.set(position.x, position.y); }sprite: SpritesheetMovieClip; speed: number = 0.1; constructor() { this.sprite = CG.Base.resourceManager.createSpritesheetMovieClip('zombieGame.person'); this.sprite.pivot.set(this.sprite.width / 2, this.sprite.height / 2); this.sprite.position.set(CG.Base.pixi.stageWidth / 2, CG.Base.pixi.stageWidth - 100); CG.Base.pixi.root.addChild(this.sprite); this.sprite.scale.set(3, 3); CG.Base.addUpdateFunction(this, this.update); /* PIXI.keyboardManager.on('pressed', (key) => { if (key == PIXI.keyboard.Key.SPACE) { new Bullet(this.sprite.x, this.sprite.y - 30, 1); } });*/ } update(dt: number): void { let move: CG.Base.geom.Point = new CG.Base.geom.Point(0, 0); if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.RIGHT)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.D)) { move.x = 1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.LEFT)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.A)) { move.x = -1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.UP)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.W)) { move.y = -1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.DOWN)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.S)) { move.y = 1; } move.normalize(dt * this.speed); let edge: number = 20; let position: CG.Base.geom.Point = CG.Base.geom.Point.fromPIXIPoint(this.sprite.position); position.x = position.x + move.x; position.y = position.y + move.y; if (position.x < edge) { position.x = edge; } else if (position.x > CG.Base.pixi.stageWidth - edge) { position.x = CG.Base.pixi.stageWidth - edge; } edge = 30; if (position.y < edge) { position.y = edge; } else if (position.y > CG.Base.pixi.stageHeight - edge) { position.y = CG.Base.pixi.stageHeight - edge; } this.sprite.position.set(position.x, position.y); }sprite: SpritesheetMovieClip; speed: number = 0.1; constructor() { this.sprite = CG.Base.resourceManager.createSpritesheetMovieClip('zombieGame.person'); this.sprite.pivot.set(this.sprite.width / 2, this.sprite.height / 2); this.sprite.position.set(CG.Base.pixi.stageWidth / 2, CG.Base.pixi.stageWidth - 100); CG.Base.pixi.root.addChild(this.sprite); this.sprite.scale.set(3, 3); CG.Base.addUpdateFunction(this, this.update); /* PIXI.keyboardManager.on('pressed', (key) => { if (key == PIXI.keyboard.Key.SPACE) { new Bullet(this.sprite.x, this.sprite.y - 30, 1); } });*/ } update(dt: number): void { let move: CG.Base.geom.Point = new CG.Base.geom.Point(0, 0); if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.RIGHT)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.D)) { move.x = 1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.LEFT)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.A)) { move.x = -1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.UP)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.W)) { move.y = -1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.DOWN)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.S)) { move.y = 1; } move.normalize(dt * this.speed); let edge: number = 20; let position: CG.Base.geom.Point = CG.Base.geom.Point.fromPIXIPoint(this.sprite.position); position.x = position.x + move.x; position.y = position.y + move.y; if (position.x < edge) { position.x = edge; } else if (position.x > CG.Base.pixi.stageWidth - edge) { position.x = CG.Base.pixi.stageWidth - edge; } edge = 30; if (position.y < edge) { position.y = edge; } else if (position.y > CG.Base.pixi.stageHeight - edge) { position.y = CG.Base.pixi.stageHeight - edge; } this.sprite.position.set(position.x, position.y); }sprite: SpritesheetMovieClip; speed: number = 0.1; constructor() { this.sprite = CG.Base.resourceManager.createSpritesheetMovieClip('zombieGame.person'); this.sprite.pivot.set(this.sprite.width / 2, this.sprite.height / 2); this.sprite.position.set(CG.Base.pixi.stageWidth / 2, CG.Base.pixi.stageWidth - 100); CG.Base.pixi.root.addChild(this.sprite); this.sprite.scale.set(3, 3); CG.Base.addUpdateFunction(this, this.update); /* PIXI.keyboardManager.on('pressed', (key) => { if (key == PIXI.keyboard.Key.SPACE) { new Bullet(this.sprite.x, this.sprite.y - 30, 1); } });*/ } update(dt: number): void { let move: CG.Base.geom.Point = new CG.Base.geom.Point(0, 0); if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.RIGHT)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.D)) { move.x = 1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.LEFT)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.A)) { move.x = -1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.UP)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.W)) { move.y = -1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.DOWN)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.S)) { move.y = 1; } move.normalize(dt * this.speed); let edge: number = 20; let position: CG.Base.geom.Point = CG.Base.geom.Point.fromPIXIPoint(this.sprite.position); position.x = position.x + move.x; position.y = position.y + move.y; if (position.x < edge) { position.x = edge; } else if (position.x > CG.Base.pixi.stageWidth - edge) { position.x = CG.Base.pixi.stageWidth - edge; } edge = 30; if (position.y < edge) { position.y = edge; } else if (position.y > CG.Base.pixi.stageHeight - edge) { position.y = CG.Base.pixi.stageHeight - edge; } this.sprite.position.set(position.x, position.y); }sprite: SpritesheetMovieClip; speed: number = 0.1; constructor() { this.sprite = CG.Base.resourceManager.createSpritesheetMovieClip('zombieGame.person'); this.sprite.pivot.set(this.sprite.width / 2, this.sprite.height / 2); this.sprite.position.set(CG.Base.pixi.stageWidth / 2, CG.Base.pixi.stageWidth - 100); CG.Base.pixi.root.addChild(this.sprite); this.sprite.scale.set(3, 3); CG.Base.addUpdateFunction(this, this.update); /* PIXI.keyboardManager.on('pressed', (key) => { if (key == PIXI.keyboard.Key.SPACE) { new Bullet(this.sprite.x, this.sprite.y - 30, 1); } });*/ } update(dt: number): void { let move: CG.Base.geom.Point = new CG.Base.geom.Point(0, 0); if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.RIGHT)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.D)) { move.x = 1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.LEFT)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.A)) { move.x = -1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.UP)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.W)) { move.y = -1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.DOWN)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.S)) { move.y = 1; } move.normalize(dt * this.speed); let edge: number = 20; let position: CG.Base.geom.Point = CG.Base.geom.Point.fromPIXIPoint(this.sprite.position); position.x = position.x + move.x; position.y = position.y + move.y; if (position.x < edge) { position.x = edge; } else if (position.x > CG.Base.pixi.stageWidth - edge) { position.x = CG.Base.pixi.stageWidth - edge; } edge = 30; if (position.y < edge) { position.y = edge; } else if (position.y > CG.Base.pixi.stageHeight - edge) { position.y = CG.Base.pixi.stageHeight - edge; } this.sprite.position.set(position.x, position.y); }sprite: SpritesheetMovieClip; speed: number = 0.1; constructor() { this.sprite = CG.Base.resourceManager.createSpritesheetMovieClip('zombieGame.person'); this.sprite.pivot.set(this.sprite.width / 2, this.sprite.height / 2); this.sprite.position.set(CG.Base.pixi.stageWidth / 2, CG.Base.pixi.stageWidth - 100); CG.Base.pixi.root.addChild(this.sprite); this.sprite.scale.set(3, 3); CG.Base.addUpdateFunction(this, this.update); /* PIXI.keyboardManager.on('pressed', (key) => { if (key == PIXI.keyboard.Key.SPACE) { new Bullet(this.sprite.x, this.sprite.y - 30, 1); } });*/ } update(dt: number): void { let move: CG.Base.geom.Point = new CG.Base.geom.Point(0, 0); if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.RIGHT)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.D)) { move.x = 1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.LEFT)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.A)) { move.x = -1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.UP)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.W)) { move.y = -1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.DOWN)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.S)) { move.y = 1; } move.normalize(dt * this.speed); let edge: number = 20; let position: CG.Base.geom.Point = CG.Base.geom.Point.fromPIXIPoint(this.sprite.position); position.x = position.x + move.x; position.y = position.y + move.y; if (position.x < edge) { position.x = edge; } else if (position.x > CG.Base.pixi.stageWidth - edge) { position.x = CG.Base.pixi.stageWidth - edge; } edge = 30; if (position.y < edge) { position.y = edge; } else if (position.y > CG.Base.pixi.stageHeight - edge) { position.y = CG.Base.pixi.stageHeight - edge; } this.sprite.position.set(position.x, position.y); }sprite: SpritesheetMovieClip; speed: number = 0.1; constructor() { this.sprite = CG.Base.resourceManager.createSpritesheetMovieClip('zombieGame.person'); this.sprite.pivot.set(this.sprite.width / 2, this.sprite.height / 2); this.sprite.position.set(CG.Base.pixi.stageWidth / 2, CG.Base.pixi.stageWidth - 100); CG.Base.pixi.root.addChild(this.sprite); this.sprite.scale.set(3, 3); CG.Base.addUpdateFunction(this, this.update); /* PIXI.keyboardManager.on('pressed', (key) => { if (key == PIXI.keyboard.Key.SPACE) { new Bullet(this.sprite.x, this.sprite.y - 30, 1); } });*/ } update(dt: number): void { let move: CG.Base.geom.Point = new CG.Base.geom.Point(0, 0); if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.RIGHT)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.D)) { move.x = 1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.LEFT)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.A)) { move.x = -1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.UP)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.W)) { move.y = -1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.DOWN)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.S)) { move.y = 1; } move.normalize(dt * this.speed); let edge: number = 20; let position: CG.Base.geom.Point = CG.Base.geom.Point.fromPIXIPoint(this.sprite.position); position.x = position.x + move.x; position.y = position.y + move.y; if (position.x < edge) { position.x = edge; } else if (position.x > CG.Base.pixi.stageWidth - edge) { position.x = CG.Base.pixi.stageWidth - edge; } edge = 30; if (position.y < edge) { position.y = edge; } else if (position.y > CG.Base.pixi.stageHeight - edge) { position.y = CG.Base.pixi.stageHeight - edge; } this.sprite.position.set(position.x, position.y); }sprite: SpritesheetMovieClip; speed: number = 0.1; constructor() { this.sprite = CG.Base.resourceManager.createSpritesheetMovieClip('zombieGame.person'); this.sprite.pivot.set(this.sprite.width / 2, this.sprite.height / 2); this.sprite.position.set(CG.Base.pixi.stageWidth / 2, CG.Base.pixi.stageWidth - 100); CG.Base.pixi.root.addChild(this.sprite); this.sprite.scale.set(3, 3); CG.Base.addUpdateFunction(this, this.update); /* PIXI.keyboardManager.on('pressed', (key) => { if (key == PIXI.keyboard.Key.SPACE) { new Bullet(this.sprite.x, this.sprite.y - 30, 1); } });*/ } update(dt: number): void { let move: CG.Base.geom.Point = new CG.Base.geom.Point(0, 0); if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.RIGHT)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.D)) { move.x = 1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.LEFT)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.A)) { move.x = -1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.UP)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.W)) { move.y = -1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.DOWN)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.S)) { move.y = 1; } move.normalize(dt * this.speed); let edge: number = 20; let position: CG.Base.geom.Point = CG.Base.geom.Point.fromPIXIPoint(this.sprite.position); position.x = position.x + move.x; position.y = position.y + move.y; if (position.x < edge) { position.x = edge; } else if (position.x > CG.Base.pixi.stageWidth - edge) { position.x = CG.Base.pixi.stageWidth - edge; } edge = 30; if (position.y < edge) { position.y = edge; } else if (position.y > CG.Base.pixi.stageHeight - edge) { position.y = CG.Base.pixi.stageHeight - edge; } this.sprite.position.set(position.x, position.y); }sprite: SpritesheetMovieClip; speed: number = 0.1; constructor() { this.sprite = CG.Base.resourceManager.createSpritesheetMovieClip('zombieGame.person'); this.sprite.pivot.set(this.sprite.width / 2, this.sprite.height / 2); this.sprite.position.set(CG.Base.pixi.stageWidth / 2, CG.Base.pixi.stageWidth - 100); CG.Base.pixi.root.addChild(this.sprite); this.sprite.scale.set(3, 3); CG.Base.addUpdateFunction(this, this.update); /* PIXI.keyboardManager.on('pressed', (key) => { if (key == PIXI.keyboard.Key.SPACE) { new Bullet(this.sprite.x, this.sprite.y - 30, 1); } });*/ } update(dt: number): void { let move: CG.Base.geom.Point = new CG.Base.geom.Point(0, 0); if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.RIGHT)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.D)) { move.x = 1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.LEFT)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.A)) { move.x = -1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.UP)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.W)) { move.y = -1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.DOWN)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.S)) { move.y = 1; } move.normalize(dt * this.speed); let edge: number = 20; let position: CG.Base.geom.Point = CG.Base.geom.Point.fromPIXIPoint(this.sprite.position); position.x = position.x + move.x; position.y = position.y + move.y; if (position.x < edge) { position.x = edge; } else if (position.x > CG.Base.pixi.stageWidth - edge) { position.x = CG.Base.pixi.stageWidth - edge; } edge = 30; if (position.y < edge) { position.y = edge; } else if (position.y > CG.Base.pixi.stageHeight - edge) { position.y = CG.Base.pixi.stageHeight - edge; } this.sprite.position.set(position.x, position.y); }sprite: SpritesheetMovieClip; speed: number = 0.1; constructor() { this.sprite = CG.Base.resourceManager.createSpritesheetMovieClip('zombieGame.person'); this.sprite.pivot.set(this.sprite.width / 2, this.sprite.height / 2); this.sprite.position.set(CG.Base.pixi.stageWidth / 2, CG.Base.pixi.stageWidth - 100); CG.Base.pixi.root.addChild(this.sprite); this.sprite.scale.set(3, 3); CG.Base.addUpdateFunction(this, this.update); /* PIXI.keyboardManager.on('pressed', (key) => { if (key == PIXI.keyboard.Key.SPACE) { new Bullet(this.sprite.x, this.sprite.y - 30, 1); } });*/ } update(dt: number): void { let move: CG.Base.geom.Point = new CG.Base.geom.Point(0, 0); if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.RIGHT)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.D)) { move.x = 1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.LEFT)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.A)) { move.x = -1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.UP)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.W)) { move.y = -1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.DOWN)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.S)) { move.y = 1; } move.normalize(dt * this.speed); let edge: number = 20; let position: CG.Base.geom.Point = CG.Base.geom.Point.fromPIXIPoint(this.sprite.position); position.x = position.x + move.x; position.y = position.y + move.y; if (position.x < edge) { position.x = edge; } else if (position.x > CG.Base.pixi.stageWidth - edge) { position.x = CG.Base.pixi.stageWidth - edge; } edge = 30; if (position.y < edge) { position.y = edge; } else if (position.y > CG.Base.pixi.stageHeight - edge) { position.y = CG.Base.pixi.stageHeight - edge; } this.sprite.position.set(position.x, position.y); }sprite: SpritesheetMovieClip; speed: number = 0.1; constructor() { this.sprite = CG.Base.resourceManager.createSpritesheetMovieClip('zombieGame.person'); this.sprite.pivot.set(this.sprite.width / 2, this.sprite.height / 2); this.sprite.position.set(CG.Base.pixi.stageWidth / 2, CG.Base.pixi.stageWidth - 100); CG.Base.pixi.root.addChild(this.sprite); this.sprite.scale.set(3, 3); CG.Base.addUpdateFunction(this, this.update); /* PIXI.keyboardManager.on('pressed', (key) => { if (key == PIXI.keyboard.Key.SPACE) { new Bullet(this.sprite.x, this.sprite.y - 30, 1); } });*/ } update(dt: number): void { let move: CG.Base.geom.Point = new CG.Base.geom.Point(0, 0); if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.RIGHT)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.D)) { move.x = 1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.LEFT)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.A)) { move.x = -1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.UP)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.W)) { move.y = -1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.DOWN)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.S)) { move.y = 1; } move.normalize(dt * this.speed); let edge: number = 20; let position: CG.Base.geom.Point = CG.Base.geom.Point.fromPIXIPoint(this.sprite.position); position.x = position.x + move.x; position.y = position.y + move.y; if (position.x < edge) { position.x = edge; } else if (position.x > CG.Base.pixi.stageWidth - edge) { position.x = CG.Base.pixi.stageWidth - edge; } edge = 30; if (position.y < edge) { position.y = edge; } else if (position.y > CG.Base.pixi.stageHeight - edge) { position.y = CG.Base.pixi.stageHeight - edge; } this.sprite.position.set(position.x, position.y); }sprite: SpritesheetMovieClip; speed: number = 0.1; constructor() { this.sprite = CG.Base.resourceManager.createSpritesheetMovieClip('zombieGame.person'); this.sprite.pivot.set(this.sprite.width / 2, this.sprite.height / 2); this.sprite.position.set(CG.Base.pixi.stageWidth / 2, CG.Base.pixi.stageWidth - 100); CG.Base.pixi.root.addChild(this.sprite); this.sprite.scale.set(3, 3); CG.Base.addUpdateFunction(this, this.update); /* PIXI.keyboardManager.on('pressed', (key) => { if (key == PIXI.keyboard.Key.SPACE) { new Bullet(this.sprite.x, this.sprite.y - 30, 1); } });*/ } update(dt: number): void { let move: CG.Base.geom.Point = new CG.Base.geom.Point(0, 0); if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.RIGHT)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.D)) { move.x = 1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.LEFT)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.A)) { move.x = -1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.UP)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.W)) { move.y = -1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.DOWN)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.S)) { move.y = 1; } move.normalize(dt * this.speed); let edge: number = 20; let position: CG.Base.geom.Point = CG.Base.geom.Point.fromPIXIPoint(this.sprite.position); position.x = position.x + move.x; position.y = position.y + move.y; if (position.x < edge) { position.x = edge; } else if (position.x > CG.Base.pixi.stageWidth - edge) { position.x = CG.Base.pixi.stageWidth - edge; } edge = 30; if (position.y < edge) { position.y = edge; } else if (position.y > CG.Base.pixi.stageHeight - edge) { position.y = CG.Base.pixi.stageHeight - edge; } this.sprite.position.set(position.x, position.y); }sprite: SpritesheetMovieClip; speed: number = 0.1; constructor() { this.sprite = CG.Base.resourceManager.createSpritesheetMovieClip('zombieGame.person'); this.sprite.pivot.set(this.sprite.width / 2, this.sprite.height / 2); this.sprite.position.set(CG.Base.pixi.stageWidth / 2, CG.Base.pixi.stageWidth - 100); CG.Base.pixi.root.addChild(this.sprite); this.sprite.scale.set(3, 3); CG.Base.addUpdateFunction(this, this.update); /* PIXI.keyboardManager.on('pressed', (key) => { if (key == PIXI.keyboard.Key.SPACE) { new Bullet(this.sprite.x, this.sprite.y - 30, 1); } });*/ } update(dt: number): void { let move: CG.Base.geom.Point = new CG.Base.geom.Point(0, 0); if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.RIGHT)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.D)) { move.x = 1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.LEFT)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.A)) { move.x = -1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.UP)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.W)) { move.y = -1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.DOWN)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.S)) { move.y = 1; } move.normalize(dt * this.speed); let edge: number = 20; let position: CG.Base.geom.Point = CG.Base.geom.Point.fromPIXIPoint(this.sprite.position); position.x = position.x + move.x; position.y = position.y + move.y; if (position.x < edge) { position.x = edge; } else if (position.x > CG.Base.pixi.stageWidth - edge) { position.x = CG.Base.pixi.stageWidth - edge; } edge = 30; if (position.y < edge) { position.y = edge; } else if (position.y > CG.Base.pixi.stageHeight - edge) { position.y = CG.Base.pixi.stageHeight - edge; } this.sprite.position.set(position.x, position.y); }sprite: SpritesheetMovieClip; speed: number = 0.1; constructor() { this.sprite = CG.Base.resourceManager.createSpritesheetMovieClip('zombieGame.person'); this.sprite.pivot.set(this.sprite.width / 2, this.sprite.height / 2); this.sprite.position.set(CG.Base.pixi.stageWidth / 2, CG.Base.pixi.stageWidth - 100); CG.Base.pixi.root.addChild(this.sprite); this.sprite.scale.set(3, 3); CG.Base.addUpdateFunction(this, this.update); /* PIXI.keyboardManager.on('pressed', (key) => { if (key == PIXI.keyboard.Key.SPACE) { new Bullet(this.sprite.x, this.sprite.y - 30, 1); } });*/ } update(dt: number): void { let move: CG.Base.geom.Point = new CG.Base.geom.Point(0, 0); if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.RIGHT)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.D)) { move.x = 1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.LEFT)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.A)) { move.x = -1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.UP)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.W)) { move.y = -1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.DOWN)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.S)) { move.y = 1; } move.normalize(dt * this.speed); let edge: number = 20; let position: CG.Base.geom.Point = CG.Base.geom.Point.fromPIXIPoint(this.sprite.position); position.x = position.x + move.x; position.y = position.y + move.y; if (position.x < edge) { position.x = edge; } else if (position.x > CG.Base.pixi.stageWidth - edge) { position.x = CG.Base.pixi.stageWidth - edge; } edge = 30; if (position.y < edge) { position.y = edge; } else if (position.y > CG.Base.pixi.stageHeight - edge) { position.y = CG.Base.pixi.stageHeight - edge; } this.sprite.position.set(position.x, position.y); }sprite: SpritesheetMovieClip; speed: number = 0.1; constructor() { this.sprite = CG.Base.resourceManager.createSpritesheetMovieClip('zombieGame.person'); this.sprite.pivot.set(this.sprite.width / 2, this.sprite.height / 2); this.sprite.position.set(CG.Base.pixi.stageWidth / 2, CG.Base.pixi.stageWidth - 100); CG.Base.pixi.root.addChild(this.sprite); this.sprite.scale.set(3, 3); CG.Base.addUpdateFunction(this, this.update); /* PIXI.keyboardManager.on('pressed', (key) => { if (key == PIXI.keyboard.Key.SPACE) { new Bullet(this.sprite.x, this.sprite.y - 30, 1); } });*/ } update(dt: number): void { let move: CG.Base.geom.Point = new CG.Base.geom.Point(0, 0); if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.RIGHT)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.D)) { move.x = 1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.LEFT)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.A)) { move.x = -1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.UP)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.W)) { move.y = -1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.DOWN)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.S)) { move.y = 1; } move.normalize(dt * this.speed); let edge: number = 20; let position: CG.Base.geom.Point = CG.Base.geom.Point.fromPIXIPoint(this.sprite.position); position.x = position.x + move.x; position.y = position.y + move.y; if (position.x < edge) { position.x = edge; } else if (position.x > CG.Base.pixi.stageWidth - edge) { position.x = CG.Base.pixi.stageWidth - edge; } edge = 30; if (position.y < edge) { position.y = edge; } else if (position.y > CG.Base.pixi.stageHeight - edge) { position.y = CG.Base.pixi.stageHeight - edge; } this.sprite.position.set(position.x, position.y); }sprite: SpritesheetMovieClip; speed: number = 0.1; constructor() { this.sprite = CG.Base.resourceManager.createSpritesheetMovieClip('zombieGame.person'); this.sprite.pivot.set(this.sprite.width / 2, this.sprite.height / 2); this.sprite.position.set(CG.Base.pixi.stageWidth / 2, CG.Base.pixi.stageWidth - 100); CG.Base.pixi.root.addChild(this.sprite); this.sprite.scale.set(3, 3); CG.Base.addUpdateFunction(this, this.update); /* PIXI.keyboardManager.on('pressed', (key) => { if (key == PIXI.keyboard.Key.SPACE) { new Bullet(this.sprite.x, this.sprite.y - 30, 1); } });*/ } update(dt: number): void { let move: CG.Base.geom.Point = new CG.Base.geom.Point(0, 0); if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.RIGHT)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.D)) { move.x = 1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.LEFT)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.A)) { move.x = -1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.UP)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.W)) { move.y = -1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.DOWN)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.S)) { move.y = 1; } move.normalize(dt * this.speed); let edge: number = 20; let position: CG.Base.geom.Point = CG.Base.geom.Point.fromPIXIPoint(this.sprite.position); position.x = position.x + move.x; position.y = position.y + move.y; if (position.x < edge) { position.x = edge; } else if (position.x > CG.Base.pixi.stageWidth - edge) { position.x = CG.Base.pixi.stageWidth - edge; } edge = 30; if (position.y < edge) { position.y = edge; } else if (position.y > CG.Base.pixi.stageHeight - edge) { position.y = CG.Base.pixi.stageHeight - edge; } this.sprite.position.set(position.x, position.y); }sprite: SpritesheetMovieClip; speed: number = 0.1; constructor() { this.sprite = CG.Base.resourceManager.createSpritesheetMovieClip('zombieGame.person'); this.sprite.pivot.set(this.sprite.width / 2, this.sprite.height / 2); this.sprite.position.set(CG.Base.pixi.stageWidth / 2, CG.Base.pixi.stageWidth - 100); CG.Base.pixi.root.addChild(this.sprite); this.sprite.scale.set(3, 3); CG.Base.addUpdateFunction(this, this.update); /* PIXI.keyboardManager.on('pressed', (key) => { if (key == PIXI.keyboard.Key.SPACE) { new Bullet(this.sprite.x, this.sprite.y - 30, 1); } });*/ } update(dt: number): void { let move: CG.Base.geom.Point = new CG.Base.geom.Point(0, 0); if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.RIGHT)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.D)) { move.x = 1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.LEFT)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.A)) { move.x = -1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.UP)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.W)) { move.y = -1; } if (PIXI.keyboardManager.isDown(PIXI.keyboard.Key.DOWN)||PIXI.keyboardManager.isDown(PIXI.keyboard.Key.S)) { move.y = 1; } move.normalize(dt * this.speed); let edge: number = 20; let position: CG.Base.geom.Point = CG.Base.geom.Point.fromPIXIPoint(this.sprite.position); position.x = position.x + move.x; position.y = position.y + move.y; if (position.x < edge) { position.x = edge; } else if (position.x > CG.Base.pixi.stageWidth - edge) { position.x = CG.Base.pixi.stageWidth - edge; } edge = 30; if (position.y < edge) { position.y = edge; } else if (position.y > CG.Base.pixi.stageHeight - edge) { position.y = CG.Base.pixi.stageHeight - edge; } this.sprite.position.set(position.x, position.y); }ddddddddddddd # zombieGame One Paragraph of project description goes here ## Getting Started These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system. ```typescript Give examples ``` ## Versioning We use [SemVer](http://semver.org/) for versioning. ## Authors * **[tonyo3o3](/profile/tonyo3o3)** ## Acknowledgments * Hat tip to anyone who's code was used * Inspiration * etc
# SpyFall > Author: [FK人(Dipsy)](https://github.com/dipsywong98/) CodeGamelet 首個完全沒用CG library,沒有typescript syntax,堅持使用完全原味javascript的遊戲上線啦!!! ~~(先躲,感覺會被小哈追殺)~~ ### 玩法 所有玩家都有一個身分和一個共同地點,除了間碟只知道自己是間碟而不知地點。玩家輪流向另外某個玩家發問,若十分鐘之內發現間諜,玩家勝,如果間諜發現地點或找不到間諜或找錯間諜,間諜勝。 建議所有玩家坐在同一個房間/開discord 作溝通,或者用內建的聊天室 ### 代碼 - 母湯看代碼哦 - 母湯看代碼哦 - 母湯看代碼哦 - 很重要所以要說三次 - 看了你會吐血 - 草泥馬只有1行代碼就能弄出又有房間系統又有firebase又那麼漂亮的遊戲,還要多語言,靠北哦刷新一下我的語言設定還在哦 - 只要功夫深,_棒磨成針,某FK用的可是iframe - window.location.href 指的是你目前的網頁位置,某FK 將它指到別處,就不需要用CG和typescript 寫遊戲啦哈哈哈 - 如果你們想看某FK真正的code,在這兒哦~ 完全免費的哦~ [https://github.com/dipsywong98/SpyFall](https://github.com/dipsywong98/SpyFall) - 具體製作方法我還是不在這兒說了吧,畢竟我是爆了五天肝才弄出來,這兒不好說,~~還有怕嚇跑初學者~~ - ~~其實我比初學也好不了多少,我2017年才開始學,所以大家要加油哦(X~~ - ~~如果你們有github帳戶,歡迎star上面的github連結哦~~ - 想給什麼意見的話,歡迎來跟某FK說哦 [https://www.facebook.com/FK.twf/](https://www.facebook.com/FK.twf/)
# CgEventsLib The engine of CgEvents. CgEvents is a great way to build your own games with with a CG.built-in editor. ## Live Demo <a href="cg://source/test/physics.events" class="mat-raised-button mat-primary">Open Demo Events Sheet</a> ## Concept The engine takes a *.events file to run. The .events file is an encoded json which contains a config field and a events field. ```json { config: { stage: { width: "number", height: "number", resolutionPolicy: "showAll" | "exactFit" | "fixedWidth" | "fixedHeight" | "origin", alignHorizontal: "left" | "center" | "right", alignVertical: "top" | "middle" | "bottom" } }, events: [ { id: "string", triggers: [], checks: [], actions: [] }, ... ] } ``` Yon can edit the json with CG.built-in editor to control all your game events. ## How Events Work Each event contains a TRIGGER, some CHECKS, and some ACTION. The event flow works like this: 1. The TRIGGER of the event is triggered by the engine (keyboard pressed, event over, or maybe the hero collides with an enemy) 1. Once the trigger is triggered, the engine then goes check the CHECKS. 1. If all CHECKS pass, the engine executes all the ACTIONS in the event. ## Getting Started ```typescript let manager = new CgEventManager(); manager.importFromSource('CG.YourProject/yourGame.events') .then(() => manager.preload()) .then(() => manager.start()) ; ``` ## Versioning We use [SemVer](http://semver.org/) for versioning. ## Authors * **[Haskasu](/profile/Haskasu)**
# TMXMap Use [Tiled Map Editor](https://www.mapeditor.org/) maps in Code.Gamelet with [pixi.js](http://www.pixijs.com/). ## What is Tiled Map Editor Tiled is a 2D level editor that helps you develop the content of your game. Its primary feature is to edit tile maps of various forms, but it also supports free image placement as well as powerful ways to annotate your level with extra information used by the game. Tiled focuses on general flexibility while trying to stay intuitive. ## Getting Started #### Usage 1. import tmx resources into one appResource ``` typescript CG.Base.resourceManager.addAppResource('TMXMap.testMap'); CG.Base.resourceManager.load(() => { CG.Base.pixi.initialize(600, 600); let tiledMap = new CG.TMXMap.MapRenderer('TMXMap.testMap'); CG.Base.pixi.root.addChild(tiledMap); }); ``` #### Usage 2. import tmx resources into a appResource, and load tmx file from source code ``` typescript CG.Base.resourceManager.addAppSource('test/beach.tmx'); CG.Base.resourceManager.load(() => { CG.Base.pixi.initialize(600, 600); let tiledMap = new CG.TMXMap.MapRenderer('test/beach.tmx') CG.Base.pixi.root.addChild(tiledMap); }); ``` To use tmx of appSource (usage 2), you need to modify the tmx: * tileset > source (tsx file) change "filename" to "resourceAlias:filename" * tileset > image > source (embeded tileset) change "filename" to "resourceAlias" or "resourceAlias:filename" ## Versioning We use [SemVer](http://semver.org/) for versioning. ## Authors * **[Haskasu](/profile/Haskasu)** ## Resources * [Official Tiled Documentation](http://doc.mapeditor.org/en/stable/) * [Tiled Youtube Tutorial](https://www.youtube.com/watch?v=ZwaomOYGuYo)
ⒸCode.Gamelet.com | Privacy Policy | Terms of Service