Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

Search the Community

Showing results for tags 'entities'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Website URL





Found 4 results

  1. Hi, in a game I'm developing I'm trying to implement the entity component model in such a way that I can have units get their components information from the tiledMap file, I load the components from the Json like so if (object.properties.components !== "") { object.properties.components.split(",").forEach(function (componentName) { entity.addComponent(new FYP.Components[componentName](this)); }, this); } FYP.Entity.prototype.addComponent = function (component) { 'use strict'; // Add component data to the entity // NOTE: The component must have a name property (which is defined as // a prototype protoype of a component function) this.components[component.name] = component.name; return this; }; FYP.Components.PlayerInputComponent = function () { 'use strict'; this.cursors = null; return this; }; FYP.Components.PlayerInputComponent.prototype = new FYP.Components.PlayerInputComponent(); FYP.Components.PlayerInputComponent.prototype.name = 'PlayerInputComponent'; FYP.Components.PlayerInputComponent.prototype.type = 'Input'; FYP.Components.PlayerInputComponent.prototype.constructor = FYP.Components.PlayerInputComponent; FYP.Components.PlayerInputComponent.prototype.initialize = function (actor) { 'use strict'; this.cursors = actor.game.keyboard.createCursorKeys(); this.cursors.leftHand = this.keyboard.addKey(Phaser.Keyboard.X); this.cursors.rightHand = this.keyboard.addKey(Phaser.Keyboard.Z); this.cursors.pause = this.keyboard.addKey(Phaser.Keyboard.P); }; FYP.Entity = function (game, position, spriteKey) { 'use strict'; Phaser.Sprite.call(this, game, position.x, position.y, spriteKey); this.commands = []; this.components = []; // Set the pivot point for this sprite to the center this.anchor.setTo(0.5, 0.5); return this; }; FYP.Entity.prototype = Object.create(Phaser.Sprite.prototype); FYP.Entity.prototype.constructor = FYP.Entity; FYP.Entity.prototype.update = function () { 'use strict'; if (this.components) { this.components.forEach(function (component) { component.update(); console.log(component); }, this); } this does not work however, and even though Entity.components seems to contain all the appropriate components the array always seems to have a length of 0 so I can't traverse it to execute the update functions
  2. What is an ECS? An ECS allows game objects to perform custom operations without any additional manager code. In an ECS, all objects in a game world are represented as entities; their properties are represented as components; and the game has systems to update entities and components. Yes. So why am I posting this? Because we've just overhauled entities in kiwi.js and written up quite a big post on it. Take a squiz... let me know what you think http://www.kiwijs.org/2015/02/kiwijs-v1-2-0-entity-component-system/
  3. Hey guys. Since our forum is quite new I wanted to share our latest update here too. I hope everybody is having a great day http://www.html5gamedevs.com/topic/12048-introudcing-120-williams/
  4. Ansimuz

    Snake Enemy

    Hi, What would be the logic or best way to create a entity followed by other entities to create a snake made of linked entities. For example a head entity that will be followed by other entities that form the body of the snake. BTW i am using impactJS
  • Create New...