I noticed that there's code for z-axis movement in the plugin, but it doesn't move the player/viewport when "jumping"
added this in my player update function:
if(ig.input.pressed('jump') && !this.jumping){
console.log('jumped');
this.vel.z = 200;
this.jumping = true;
}
just to see if it worked and the player doesn't move up or down. tried both + and - z velocity
am I missing something? also is there a way to make the game more than 1 tileheight high? or is it just a single ground level for now?
10 years ago
by Joncom
Mind baking your game and hosting it so we can see what you mean? Not sure what z-velocity is supposed to be to be honest, but seeing what you're talking about might make it clear quickly.
http://enginedev.movingknowledge.com/impact/
controls WASD or arrows to move (can only strafe, not rotate)
spacebar to jump.
-Note: the blue space above you when it first loads is where I removed the ceiling tiles
the 'jump height' output is displaying player.pos.z of the xyz coordinate space
in this plugin X is left to right and Y is foreward/back and Z is supposed to be up and down.
this is code right from tpf.Entity for floor collision:
// handle the z-axis collision with the floor
this.pos.z += this.vel.z;
if( this.pos.z < 0 ) {
if( this.bounciness > 0 && Math.abs(this.vel.z) > this.minBounceVelocity ) {
this.vel.z *= -this.bounciness;
}
else {
this.vel.z = 0;
}
this.pos.z = 0;
}
so z spacing is supposedly happening.
Did you subclass from tpf.Entity?
yes.
to test the functionality, I essentially just took dominic's twopointfive demo and removed the blobs/weapons and altered the controls.
the tile size and player size were both 32 so I changed the player to 8 to try giving it "room" to jump but it doesn't appear to affect even the view height on load.
10 years ago
by fox1t
Quote from Skywalker
http://enginedev.movingknowledge.com/impact/
controls WASD or arrows to move (can only strafe, not rotate)
spacebar to jump.
-Note: the blue space above you when it first loads is where I removed the ceiling tiles
the 'jump height' output is displaying player.pos.z of the xyz coordinate space
in this plugin X is left to right and Y is foreward/back and Z is supposed to be up and down.
this is code right from tpf.Entity for floor collision:
// handle the z-axis collision with the floor
this.pos.z += this.vel.z;
if( this.pos.z < 0 ) {
if( this.bounciness > 0 && Math.abs(this.vel.z) > this.minBounceVelocity ) {
this.vel.z *= -this.bounciness;
}
else {
this.vel.z = 0;
}
this.pos.z = 0;
}
so z spacing is supposedly happening.yes.
to test the functionality, I essentially just took dominic's twopointfive demo and removed the blobs/weapons and altered the controls.
the tile size and player size were both 32 so I changed the player to 8 to try giving it "room" to jump but it doesn't appear to affect even the view height on load.
Are you sure that you modified the correct values. As i can see there is only x and y players values. In addition to it, you have to check on the camera settings not on the player. This is not a real 3D, so the Z axis is just a matrix with the perspective...
10 years ago
by davidg0
Maybe the vpos of the player changed succesfully, but the player camera did not move.
9 years ago
by fox1t
Quote from davidg0
Maybe the vpos of the player changed succesfully, but the player camera did not move.
Exactly. The player actually doesn't esist...
9 years ago
by dominic
The camera position in TwoPointFive is not directly bound to the player position. The Player&
039;s #update
method in the example game just happens to update the camera position as well.
See
lib/game/entities/player.js, line 202... in the example game.
ig.system.camera.setPosition()
incorporates the
bobOffset
, but not the players z-position.
Try this (line 216):
ig.system.camera.setPosition( cx, cy, bobOffset + this.pos.z );
Page 1 of 1
« first
« previous
next ›
last »