How do I create objects along the line?

0 favourites
  • 11 posts
From the Asset Store
solution for games like "fruit ninja" and drawing applications
  • Hello all! I've stumbled upon an interesting problem. Maybe somebody will be able to help.

    So in my game you can shoot lasers. Laser disappears in a fracture of second after it hits the target and spawns a trail of particles behind. X randomizer of that particles is equal to laser's width, Y randomizer is equal to 2 and rate is equal to int(laser.width / 8). It looks like this:

    Everything looks fine until laser's are horizontal but particles always spawn in a horizontal line even when the laser is vertical or diagonal. Rotating particles object itself doesn't help. It looks like this:

    Instead of this:

    What is the best way to achieve this effect? Spawn separate sprites perhaps? But how can I spawn objects along the line? Thanks in advance!

  • Rotating the particle object should help because it's the angle of the particle object that you need to change for the direction. When you spawn it, set the angle also with an action.

  • Rotating the particle object should help because it's the angle of the particle object that you need to change for the direction. When you spawn it, set the angle also with an action.

    No, it's not working as I said before. Here is the sample .c3p file that demonstrates my problem. Shoot with LMB and you'll see that only horizontal shots looks fine.

    dropbox.com/s/f25m5k73cxhry1q/laser_trail.c3p

  • Looks like particles are better for spray in a direction, it doesn't rotate the original image. Better to use sprites as you mentioned above.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Looks like particles are better for spray in a direction, it doesn't rotate the original image. Better to use sprites as you mentioned above.

    Spawning sprites along vertical or horizontal line is an easy task but what is the best way to spawn them alongside diagonal laser?

  • The events you have now should work with a sprite, it will face the same way as the laser.

  • The events you have now should work with a sprite, it will face the same way as the laser.

    One long sprite won't work because lasers can be of any length. It will look distorted and I need pixel-perfect image. On the other hand tiled background might do the job... I'll try it out today.

  • change your display settings from Nearest to Biliniar or Triliniar it works for me. it is a rendering low quality issue.

    Click project folder name in right side ... and left side on settings bar u have display area and under Sampling select Triliniar and is all looking smooth for me.

  • 1drv.ms/u/s!AkmrWgxeuxlKhIg-7JoGEwomBLceSg

    Play around with that.

  • change your display settings from Nearest to Biliniar or Triliniar it works for me. it is a rendering low quality issue.

    Click project folder name in right side ... and left side on settings bar u have display area and under Sampling select Triliniar and is all looking smooth for me.

    Yes, I know that. I meant that you can't use one long sprite because you'll have to stretch it eventually. And stretching will distort the sprite. And spawning tons of little sprites instead of particles will ruin the performance during an intense gunfight. That's why I switched to tiled background and achieved the desired effect with the random X offset property.

  • 1drv.ms/u/s!AkmrWgxeuxlKhIg-7JoGEwomBLceSg

    Play around with that.

    That's an interest approach. Thanks for sharing! But I've achieved the desired effect using tiled background object with random X offset already.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)