_neon's Forum Posts

  • 10 posts
  • It's much easier to help if you share your project file. But from just looking at that code, it looks like textInstance refers to an ITextInstance. That's a whole class - you can't just assign a string to it. You probably meant to assign the text property instead.

    hey thanks for the link to it but may i ask how to assign it as text? thanks!

  • so im trying to make a text that will change depending on what the ammount of an object is but i cant get the text to change?

    let score = plant.itemCount

    const textObject = runtime.objects.Text;

    const textInstance = textObject.getFirstPickedInstance();

    textInstance="score";

    i know some of the code works i think its only the textinstance = score that isnt working

  • so im making a vampire survivor mixed with bullet hell game, the problem im having is that the enemy always overlap each other, so i used if collide then bounce, but everytime theres a lot of enemies they get stuck on each other

  • my event sheet currently is

    [is overlapping sprite]

    move 1 pixel

    it keeps draggin other of the same sprite lol

  • hey this is how u should do the code

    the number for x should be the right & left side of ur square

    and y the up & down

  • hey there heres how u do it

    step 1 - add mouse

    step 2 - add condition in event sheet [on click] & [curser is over object]

    step 3 - add action [set x pos of ur sprite too [floor(random(corner of square, the other corner of the square))]

    step 4 - repeat for y but instead of the other corner go to the bottom corner

    and that should do it if it doesnt work just ask me ill help

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Ashley I've finish some of "learn javascript" but im still confused on how to make a collision code

  • That doesn't look like valid JavaScript code.

    If you are new to JavaScript coding I'd recommend going through the Learn JavaScript in Construct tutorial series, which will help you get the basics right.

    THANK YOU SO MUCH!

  • > if (sprite.x === sprite2.x && sprite.y === sprite2.y )

    You are comparing if their origins are exactly overlapping. This is extremely unlikely to ever be true. You should use testOverlap instead, see

    https://www.construct.net/en/make-games/manuals/construct-3/scripting/scripting-reference/object-interfaces/iworldinstance#internalH1Link3

    I also recommend checking out the javascript examples since they'll cover most of the basic cases like that.

    hey so i changed my script but still doesnt work

    function onCollisionBetweenSprites(Sprite, sprite2) {

    if (sprite.testOverlap(sprite2));

    {

    wood + 1

    destroy,sprite2

    }

    }

    onCollisionBetweenSprites;

    this my new script

  • This is the code

    function onCollisionBetweenSprites() {

    if (sprite.x === sprite2.x && sprite.y === sprite2.y ) {

    wood += 1;

    }

    }

    is there a mistake here?

    im trying to make some code to destroy sprite 2 when sprite 1 touches it

  • 10 posts