excaliburjs / excalibur Goto Github PK
View Code? Open in Web Editor NEW๐ฎ Your friendly TypeScript 2D game engine for the web ๐ก๏ธ
Home Page: https://excaliburjs.com
License: BSD 2-Clause "Simplified" License
๐ฎ Your friendly TypeScript 2D game engine for the web ๐ก๏ธ
Home Page: https://excaliburjs.com
License: BSD 2-Clause "Simplified" License
This will improve the performance of grid based collision detection.
//x, y, cellWidth, cellHeight, rowCount, colCount
var collisionMap = new CollisionMap(....);
var somethingUseful = collisiomMap.collides(actor);
ctx.save();
ctx.translate(this.x, this.y);
ctx.scale(this.scale, this.scale);
ctx.rotate(this.rotation);
if(this.spriteFont){
this.spriteFont.draw(ctx, 0, 0, this.text);
}else{
ctx.fillStyle = 'black';
ctx.fillText(this.text, 0, 0);
}
super.draw(ctx, delta);
ctx.restore();
Play Once
Cycle
Ping Pong
Something like this perhaps
var color = Color.fromRGB(0,0,0);
var color2 = Color.fromHex('#ffffff');
or this
var color = new Color(0,0,0);
var color2 = new Color('#ffffff');
Enter view port event - 'enterviewport'
Exit view port event - 'exitviewport'
More specific collision events - 'collidesbottom', 'collidestop', 'collidesleft', collidesright'
load
gamestart
Key Combinations - 'ctrl+b'
mousemove
touchstart
touchend
touchmove
touchcancel
Currently when events are thrown the are emitted as "global", which means that multiple collision events may be thrown and every actor must check whether the event applies to them. This is incredibly inefficient, the EventDispatcher should only send events to actors that apply to them.
The engine needs new collision primitives that can collide with one another like:
BoundingCircle
BoundingBox
BoundingPoly
BoundingPixels
Create some jsDoc style documentation about the engine
var red = Color.RED;
var blue = Color.BLUE;
var green = Color.GREEN;
If we abstract the drawing layer, we could swap 2D canvas drawing for DOM, or WebGL. No rush on this feature.
This is useful when determining child actor positions globally in the game, and not relative to their parent.
Need to walk up the scene graph to find out what these are.
var actor = new Actor();
actor.kill() // does nothing since it has no parent
game.addChild(actor);
actor.kill() // removes itself from its parent SceneNode
animation.isDone();
Things like sound, actor, and physics have no business in the core
This is a huge problem when subclassing Actors
I suspect we will need to play some tricks with an off screen canvas, after running some tests, the canvas shadowBlur is too slow.
The current implementation assumes that sprite sheets will be nicely organized horizontally. Sprite sheets need the ability to arbitrarily slice source images to produce animations.
Engine needs to be part of the animation constructor for this to work.
var animation = new Animation(images, engine, ....);
animation.play(x,y);
The loader should also display a progress bar indicating progress.
The progress bar drawing should be overloadable as well.
Something like
var loader = new Loader();
loader.addSound(somesound);
loader.addImage(someimage);
loader.addSpriteSheet(somess);
game.loader = loader;
or
game.start(loader);
or on game init
var game = new Game(600,400,'#game', loader);
This would be relevant for npcs or enemies in the game where you would want to move them based on some 'script'
This would make it easier to do parallax type animations, as well as UI and foreground elements.
Efficient particle effects would be a really neat feature to have in a game.
Right now key press debug output is always drawn to the screen. Add a flag to the game container.
Maybe add an api for developers to attach a key press to toggle debug output.
It might be a good idea to implement a finite state machine to assist in the scripting api.
Create a shim layer to handle drawing of each frame see mozilla mdn:
https://developer.mozilla.org/en-US/docs/Web/API/window.requestAnimationFrame
var requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame ||
window.webkitRequestAnimationFrame || window.msRequestAnimationFrame;
window.requestAnimationFrame = requestAnimationFrame;
StorageManager
Probably better as an Excalibur plug-in/feature.
Pseudocode
interface IPersistenceStore {
version: string;
migrations: IMigration[];
init(): void;
get<T>(key: string): T;
store(key: string, value: any): void;
// ... promises?
}
var storage: ex.Storage.IPersistenceStore = new ex.Storage.AmplifyStore("my-game-store");
// handle versioning?
storage.version = "2.0";
storage.migrations.add("1.0", "2.0",
(from, to) => { // from
},
(to, from) => { // to
}); // ex.Storage.IVersionMigration
// set options
...
// load up existing DB/create new one and run migrations
storage.init();
// get prefs
var prefs = storage.get<IPreferences>("preferences");
// update prefs
prefs.showTutorials = false;
// store prefs
storage.store("preferences", prefs);
Hopefully we can just wrap storage providers rather than build our own. Really we just want to handle versioning.
The idea of a sound sprite that push all your sound effects into a single sound file, so only one trip to the server is made. Similar to the idea behind atlases or sprite sheets.
Need a way to encode offsets and lengths to play the appropriate sound in the sound sprite.
Check out example here
http://www.html5rocks.com/en/tutorials/doodles/gamepad/
Doesn't make sense in the public API
In some places times are expected in seconds like the ".delay" and the ".getAnimationByIndices" they should be converted to using milliseconds.
This is useful when you want to use retro fonts from sprite sheets
An unknown error is being thrown at the start of the game.
It looks to be an 'undefined' eventName being passed to the event dispatcher publish
[DEBUG] : Game started Engine.js:970
Uncaught TypeError: Cannot call method 'toLowerCase' of undefined Engine.js:1159
[DEBUG] : Game stopped Engine.js:970
We should utilize the HTML5 Sound Api and fall back as appropriate
Probably should have a testing framework backing api claims :)
The engine only implements naive collision detection on rectangles without rotation. It should provide a more robust system allowing arbitrary polygons to collide.
A logging setup around the concept of appenders would be useful and extensible as in log4j or log4net.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.