1 decade ago by Jon
Hello all,
I am trying to find a way to create multiple images of a ball inside of one entity. Each image may be different sizes from one another. After hitting this entity with my game's bullets...I need a way to determine which of the balls were actually struck.
I was originally planning on creating one entity that creates the image itself (lets call this EntityImageCreate) and another entity that will call this create multiple times (lets call this EntityImageCombine). This will ensure that each of these balls are part of the same Combine entity. However, I am receiving the following error when it calls the spawnEntity of the Create:
uncaught exception: Can't spawn entity of type imagecreate
Here is EntityImageCombine:
Here is EntityImageCreate:
Does anyone see my issue? Or perhaps have a better suggestion on how to accomplish my goal?
Thanks!
I am trying to find a way to create multiple images of a ball inside of one entity. Each image may be different sizes from one another. After hitting this entity with my game's bullets...I need a way to determine which of the balls were actually struck.
I was originally planning on creating one entity that creates the image itself (lets call this EntityImageCreate) and another entity that will call this create multiple times (lets call this EntityImageCombine). This will ensure that each of these balls are part of the same Combine entity. However, I am receiving the following error when it calls the spawnEntity of the Create:
uncaught exception: Can't spawn entity of type imagecreate
Here is EntityImageCombine:
ig.module( 'game.entities.imagecombine' ) .requires( 'impact.entity', 'game.entities.enemy' ) .defines (function(){ EntityImageCombine = EntityEnemy.extend({ size: { x: 8, y: 14}, init: function (x, y, settings){ this.parent( x, y, settings ); this.generate(); this.lastAttackTimer = new ig.Timer(); }, generate: function() { ball1= ig.game.spawnEntity('imagecreate',18,18), <---------The error is occurring here ball2= ig.game.spawnEntity('imagecreate',18,18) } });
Here is EntityImageCreate:
ig.module( 'game.entities.imagecreate' ) .requires( 'impact.entity', 'game.entities.enemy' ) .defines (function(){ EntityImageCreate = EntityEnemy.extend({ animSheet: new ig.AnimationSheet( 'media/web/ammo/ball.png', 18, 18), size: { x: 8, y: 14}, offset: {x: 4, y:2}, maxVel: {x: 100, y: 100}, speed: 140, init: function (x, y, settings){ this.parent( x, y, settings ); this.addAnim( 'idle', 1, [0]); this.lastAttackTimer = new ig.Timer(); } }); });
Does anyone see my issue? Or perhaps have a better suggestion on how to accomplish my goal?
Thanks!