How do I make a code to move an entity?

Hello everyone, this is my first post, and I wanted you to help me with one thing. I wanted to make a script to make an entity in a primitive form (cubes, capsules, spheres, etc.). If you can, respond. I am creating my first game.

Hello @DudeDay012 and welcome! Please post your messages in English language. I have already translated this topic for you.

1 Like

Hello, I’m Portuguese, and my true name is Martim.
I need some help, because I wanna create a FPS game, but I don’t know how.
Before you answer my topic, you need to read the list of the described scripts I need to create my game:

1st Camera position (in front of the player’s sprite face);
2nd FPS player movement;
3rd The camera stay in it’s position (while the player is walking, jumping, etc);
4th Gun;
5th FOV (Field Of Vision);
6th Camera rotation (using the mouse);
7th Enemies.

This is what I need (per now).

1 Like

I think a good start is to look at the first person example project. You can optionally fork the project. This will give you a copy of the project that you can use as a basis for your own game.

https://developer.playcanvas.com/en/tutorials/first-person-movement/

1 Like

I want to make FPS games too!!!

How can I create a script that can make the entity move? (ex.: Box).
Send me the right script to make the entity move (without any key of the keyboard). I need the most recent movement script. And don’t forget, I’m using the WINDOWS 10 system.
But is not a first person movement, NO FPS, I just need help to make a test at my project!

Hi @DudeDay012,

Check the script in this example:

https://developer.playcanvas.com/en/tutorials/first-person-movement/

Hi @DudeDay012,

There are many ways to make an entity move. What type of behavior are you looking to have your box exhibit?

@DudeDay012 Please don’t make new topics for the same question as you’ve asked very recently. This is the second time that you have done so.

Below the most basic way to move an entity constant without using physics.

var Moving = pc.createScript('moving');

// initialize code called once per entity
Moving.prototype.initialize = function() {
    
};

// update code called every frame
Moving.prototype.update = function(dt) {
    this.entity.translateLocal(0, 0, -1);
};