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

8 years ago by Montana

noob error:

checkAgainst:ig.Entity.TYPE.A,
update: function(){},
	
check: function(other){
	ig.game.player.jump = 1;
}

whats the correct syntax for altering a player specific var (and a global entity var)?

ig.game.player.jump
ig.game.entities.player.jump
ig.game.entityplayer.jump
ig.game.player jump =
etc etc
i is moran :-D

8 years ago by Montana

FINALLY ..WOOT :-D

checkAgainst:ig.Entity.TYPE.A,
update: function(){},
	
check: function(other){
	other.jump.x = 7;
}

8 years ago by Montana

Now have to work it out this way ..
	if( res.tile ==  "3") {
		accelGround = 600;
		res.friction.x = 10;
		res.maxVel.x= 400;
	}
	this.parent(res);
}


res.friction.x = 10;
res.maxVel.x= 400;

should be:

????.friction.x=xx;

8 years ago by alexandre

Montana can you edit your posts and wrap your code in "##" markers? Will make it easier to spot the problem.

For example, wrapping some of what you wrote in "##" gives:
if ( res.tile == "3")
{
  accelGround = 600;
  res.friction.x = 10;
  res.maxVel.x= 400;
}

8 years ago by dominic

(I edited your posts to enable syntax highlighting)

You want to refer to the entity on which the handleMovementTrace() method was called on - which is this.

res is a trace result and has the properties that as specified in the documenation. Also, you created a global variable called accelGround and force a type conversion of integer to string with the comparison to "3" - which probably wasn't your intention.

Do yourself a favor and buy a book about JavaScript.
Page 1 of 1
« first « previous next › last »