[SOLVED] Coding Help for Enemy Projectiles

Here is what I have so far.

var Enemylaser = pc.createScript('enemylaser');

// initialize code called once per entity
Enemylaser.prototype.initialize = function () {


// update code called every frame
Enemylaser.prototype.update = function (dt) {

        var templateAsset = this.app.assets.find("EnemyLaser");
        var instance = templateAsset.resource.instantiate();
        var position = this.entity.getPosition();

        var entity = new pc.Entity();

        entity.translate(position.x - 0.01, position.y, position.z);


// swap method called for script hot-reloading
// inherit your script state here
// Enemylaser.prototype.swap = function(old) { };

// to learn more about script anatomy, please read:
// https://developer.playcanvas.com/en/user-manual/scripting/```

@Vapor_Trout Hi. Is there a question or issue you are having in this post? I can see the code which seems to be executed every update cycle. If there is a project this is attached to it would also be helpful to get a link so the forum can help.


Here it the game, everything is on level 1

@Vapor_Trout Line 20 needs to be removed since it does not have an opening brace

I removed it.

@Vapor_Trout I see it is fixed. Can I mark this as solved?

Thanks it spawns but now i need it to spawn with the enemy player. Is there a way to do that.

@Vapor_Trout This topics is solved. Please post another topic related to the new question along with your link to the game as you did above. Also, provide as mush information as possible.

1 Like

k. Thanks for the help.