So i started checking the engine out and following the simple tutorial from the documentation, the platformer one, and everything was ok until it was time to add the collision detection to the game, once added my character wouldn't move at all, not in the slightest, help ? this is how my player behavior looks like:
Sup.ArcadePhysics2D.setGravity(0, 0);
class PlayerBehavior extends Sup.Behavior {
//stores the idle state to transition to when player stops pressing a key
public currentIdle: string;
//How fast the player can go
public _maxSpeed = 0.1;
//The acceleration rate
public acceleration = 1;
//How fast he decelerate
public _decelaration = 0.002;
//Current speed
private _speed = 0;
awake() {
this.currentIdle = "Idle_Dwn";
this.actor.spriteRenderer.setAnimation(this.currentIdle);
}
update() {
Sup.ArcadePhysics2D.collides(this.actor.arcadeBody2D, Sup.ArcadePhysics2D.getAllBodies());
let velocity = this.actor.arcadeBody2D.getVelocity();
if (Sup.Input.isKeyDown("LEFT")) {
// Move the current behavior's actor by a small negative offset on the X axis
//Trying to implement inertia
velocity.x = -0.3;
//Sup.log(`Actor ${velocity}`);
//Sup.Math.clamp(this._speed,0,this._maxSpeed);
//this.actor.move(new Sup.Math.Vector3(-0.1, 0, 0));
this.actor.spriteRenderer.setAnimation("Walk_Left");
this.currentIdle = "Idle_Left";
}else if (Sup.Input.isKeyDown("RIGHT")) {
// Same but positive to go to the right
//velocity.x += this.acceleration;
//Sup.log(`Actor ${velocity}`);
//this.actor.move(new Sup.Math.Vector3(0.1, 0, 0));
this.actor.spriteRenderer.setAnimation("Walk_Right");
this.currentIdle = "Idle_Right";
}else if (Sup.Input.isKeyDown("UP")) {
// Move the current behavior's actor by a small negative offset on the X axis
//this.actor.move(0, 0.1, 0);
//velocity.y += this.acceleration;
this.actor.spriteRenderer.setAnimation("Walk_Up");
this.currentIdle = "Idle_Up";
}else if (Sup.Input.isKeyDown("DOWN")) {
// Move the current behavior's actor by a small negative offset on the X axis
//this.actor.move(0, -0.1, 0);
//velocity.y += -this.acceleration;
this.actor.spriteRenderer.setAnimation("Walk_Dwn");
this.currentIdle = "Idle_Dwn";
}else
{
this.actor.spriteRenderer.setAnimation(this.currentIdle);
}
}
}
Sup.registerBehavior(PlayerBehavior);
I wanted the player to be able to move on a top down perspective, but it won't move on any direction at all