Need help making a ball game with shooting

could you send me the code so the ball will do the thing and…could you tell me how to put the code into the well code editor properly?

“Do the thing”, beautiful. Yeah just copy and paste this entire code into some js file:

var Ballstuff = pc.createScript('ballstuff');
Ballstuff.attributes.add('camera', {
type: 'entity',
});
Ballstuff.attributes.add('turret', {
type: 'entity',
});
Ballstuff.prototype.initialize = function() {
this.force = new pc.Vec3();
};
Ballstuff.prototype.update = function(dt) {
this.turret.setPosition(this.entity.getPosition());
this.entity.rigidbody.applyImpulse(0*dt, -500*dt, 0*dt);
if (!this.camera) {
this._createCamera();
}
var force = this.force;
var app = this.app;
var forward = this.camera.forward;
var right = this.camera.right;
var x = 0;
var z = 0;
if (app.keyboard.isPressed(pc.KEY_A) || app.keyboard.isPressed(pc.KEY_Q)) {
x -= right.x;
z -= right.z;
}
if (app.keyboard.isPressed(pc.KEY_D)) {
x += right.x;
z += right.z;
}
if (app.keyboard.isPressed(pc.KEY_W)) {
x += forward.x;
z += forward.z;
}
if (app.keyboard.isPressed(pc.KEY_S)) {
x -= forward.x;
z -= forward.z;
}
if (x !== 0 || z !== 0) {
force.set(x, 0, z).normalize().scale(Playerpower);
this.entity.rigidbody.applyForce(force);
}
};

which “js file”?

A js file. Any empty script file.

I got it to work thanks but there’s a problem with the camera it’s on the right side of the ball so the W = right S = left D = back A = forward

Where is your project exactly?

@ALUCARD do you mean the game? if so I don’t know for shore how to let you edit it