Closed timolins closed 10 years ago
Hi @Deesr,
why don't you just extend the player abstract? You can add your own character specific methods there too.
javascript
ig.module( 'game.entities.player' )
.requires(
'plusplus.abstractities.player'
)
.defines(function () {
ig.EntityPlayer = ig.global.EntityPlayer = ig.Player.extend({
size: {x: 8, y: 14},
offset: {x: 4, y: 2},
animSheet: new ig.AnimationSheet( "media/player.png", 16, 16),
animInit: "idleX",
animSettings: {
idleX: { sequence: [0], frameTime: 0.1 }
},
myOwnMethod: function(){
// Add here your awesome game mechanics ;-)
}
});
});
The player abstract extends the character abstract. So you got everything there what you need ;-)
Because I want to base it off another Character Sub-Class. It's going to be a Multiplayer Game, and every Ingame Character is based on that Sub-Class. But since I need a controllable Character I thought this was the easiest solution to use the same base-class and then just add the name "player".
A few ideas ...
Is the performance of your sub class dynamic?
performance: "dynamic"
If you call ig.game.getPlayer()
, do you get your character sub class?
I believe @Pattentrick is correct, the default character performance is movable
, which does not include physics. Check https://github.com/collinhover/impactplusplus/blob/master/lib/plusplus/abstractities/player.js to look at some of the settings used.
Yes, that was the problem. Movement works again, but triggering events (like Sreenshake) don't seem to work, still.
Character entities don't collide with other entities by default. So your character won't collide with the camera trigger and it's activate method won't be triggered. Add this to your class:
collides: ig.EntityExtended.COLLIDES.LITE
As @collinhover mentioned, take a look at the player class for more infos on that.
Yes, I already tried that, but it still doesn't seem to work.
Go back to square one and have your player characters extend ig.Player
for the moment. Does the movement work?
Yes it does, but movement was already fixed, just the triggers didn't work.
So even if you extend ig.Player
the trigger won't work on collision? Are you using an own modified trigger entity, or are you using some of the trigger entities that came with ++? If you made your own trigger entity, can you post the code of that one? If not, did you modify some of its propertys in the Weltmeister level editor? Can you also post the whole code of your player as it is at the moment?
I could swear that this is just caused by a missing/false property on the player or the trigger.
I'm going to agree with @Pattentrick here, something small is missing. @Deesr can you post some demo code that shows the issue? It is much easier to track the problem if we're not guessing blind =)
Assuming this is fixed as we've heard nothing for some time. If not, please reopen =)
Hello!
In my current project I need to create a player from a custom Character Class. In the docs it says, I just need to set the name of the entity to "player", which doesn't work properly. When I try to move the player, it correctly flips in to that direction, but it stays at the same place. Even in the Debugger, I wasn't able to locate any velocity!
This is the code im using:
I'm not really sure where the problem is, but it seems like a bug in PlusPlus and not in my source, but I could be wrong.