Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

10 years ago by henonchesser

So I'm working on a new project and I just need a second pair of eyes.

I'm creating an entity, very simple one for now. I can put it in maps but I can't see it. Nor does it respond to controls. I have a get entity function running in the main.js, so I know the entity is present. Maybe it's just a type or a good but I can't see it.

Using one plug in from this thread / Grid Walk

    ig.module (
	'game.entities.actor'
	)
.requires (
	'impact.entity',
	'plugins.gridmovement'
	)
.defines (function() {

	EntityActor = ig.Entity.extend ( {

		movement: null,

		//LOCAL VARIABLES/////////////////////////////////////////////////////////
		name: 'player1',
		//Size, Bounds, Orientation
		size: { x:24, y:24 },
		offset: { x:0, y:0 },
		flip: false,
		zIndex:50,
		gridSpeed: {x: 100, y:100},

		animSheet: new ig.AnimationSheet( 'media/character.png',  24, 24 ),

		init: function( x, y, settings) {
	
			this.movement = new GridMovement(this);

			this.addAnim( 'idle', 1, 1);

			//defualt settings, overides anything before it
			this.parent( x, y, settings);

			

		}, //INITIALIZE 

		upate: function(x, y, settings){
			this.currentAnim = this.anims.idle;

			

			this.movement.update();

			if (ig.input.state('left'))
                    this.movement.direction = GridMovement.moveType.LEFT;
                else if (ig.input.state('right'))
                    this.movement.direction = GridMovement.moveType.RIGHT;
                else if (ig.input.state('up'))
                    this.movement.direction = GridMovement.moveType.UP;
                else if (ig.input.state('down'))
                    this.movement.direction = GridMovement.moveType.DOWN;


                this.parent();

                
		},

		check: function(x,y,settings){
			this.movement.collision();
		},

		draw: function(){
			this.parent();
		}
	
	});
});

10 years ago by dungeonmaster

First try fixing your addAnim:
this.addAnim( 'idle', 1, [0]);

In the original post for the plugin it says somewhere near the updates:

this.movement.speed.x or .y

you used gridSpeed{x:100,y:100}

Maybe changing this would help.

Also in your update
this.currentAnim = this.anims.idle;
is unnecessary code but it shouldn't be related to your problem.

Try turning the debug mode on in the impact and show the entity collison boxes. If you can see the collision box but not the entity.

Finally, I don't know how plugin works, but you created this.movement before calling this.parent(x,y,settings) in the init. Try moving the call to this.parent(...) to the top of the init block.

10 years ago by henonchesser

Your hep with the animation worked. Forgot that it had to be set up like an array.

The movement is still giving me some issues, the actor just doesn't move. Setting the speed doesn't seem to affect it. And the speed is being set in the plugin.
Page 1 of 1
« first « previous next › last »