Coin-coin le Canapin's Forum Posts

  • Thank you for the explanation.

    I'll look at this

  • Hi.

    I'm working on a game similar to worms.

    I'm trying to use the Canvas plugin to destroy the landscape pixel per pixel.

    I've also set up some events to create more or less particles, regarding the proportion of destroyed landscape.

    You can check it up here : http://canapin.com/construct/worms/terrain

    Basically, it checks every X pixels in the square containing the round hole created on each click.

    You can increases X to get lower precision and better performances.

    The main issue here is that checking every single pixel of a square is VERY slow. Why ?

    The computer freezes for about a second when I check for every pixel.

    It stills freezes for a short time even if I checks every 4 pixels. That's acceptable for a turn bases game thought, but not that nice.

    Is there any other way to do the same thing with better performances ?

  • No, I did not. How does this work ?

    eli0s : Thank you, I've done something like this to get my font preloaded.

  • Nice, thanks !

  • I thought about this too, I'll give a try.

  • I thought about this but it would be a nice solution if my target hitbox was a square, which is not

    edit : well, it's actually a circle. Maybe I can just, every tick, check the distance between the center of my first object and the center of my target. If the distance is equal or smaller than the target radius, then it's a hit.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • hi.

    I'd like to check if the center of a moving object (default imagePoint) is currently colliding or overlapping the hitbox of another object. How can I achieve this ?

  • Hi. I've set up a custom font on a text element, but it starts loading only when the text is visible, which is ugly because the font suddently change on the screen when it's loaded. Like from Arial to my custom font.

    Any idea ?

  • You can do something like

    system > every 1 sec

    --- system > create object at position (random(0,layout.Width), layout/Height)

    And use another event to make them fall. What kind of fall do you want to achieve? Do they should stop when they have reached a certain distance ?

  • Hi.

    Do you know if there is an efficient way to see if a disk shaped sprite overlaps with a canvas background (all pixels but those with alpha = 0) ? And maybe in which proportions (about how much pixels it is overlapping) ?

    Or maybe just a circle shaped sprite, it will be enough...

  • Funkyy : [attachment=0:2pizyebx][/attachment:2pizyebx]

    korbaach : Indeed it works perfectly with a simple "play", thank you for this suggestion (hard to believe I didn't try...)

    But the question remains : why it doesn't play the first sound when using a "play at" ?

    I play at the current player object, which exists the first time I play the sound in my events. :s

  • Hi.

    I put a sound when we release space or ctrl key, but it never plays the first time. Any idea why ?

    My sounds are preloaded.

  • I managed to properly use the first solution (there was an issue in my previous events) for my falling vehicules and it's accurate enough to land on a 1px tall ground. Thank you very much for your help

  • Thank you.

    When I increases the steps in your file (for example 50 steps), a single projectile fired with the N key creates 3 holes, that's weird.

    I have another question for you !

    As you can see on my capx, the vehicule falls (physic behavior) and stops its fall when it encounters a non transparent pixel.

    I have the same problem I had with the projectiles : because of the fall speed, it doesn't stops on the first non transparent pixel encountered during its trajectory.

    Simply put, it will fall through a thin ground.

    To avoid this issue, I tried your second solution checking each pixel during the trajectory.

    It doesn't work as expected on my file.

    Here, I used this to create a 1 pixel tall blue bar for each pixel during the vehicule fall, but it appears that it doesn't check every pixel during the trajectory.

    [attachment=2:28xq0nyh][/attachment:28xq0nyh]

    The red line is part of the landscape and the vehicule should land on it.

    [attachment=1:28xq0nyh][/attachment:28xq0nyh]

    So, it obviously misses some non transparent pixels on this trajectory, which causes the vehicule to passes through them.

    Any idea about how to avoid that ?

    Last question, this time about my projectile again. So I used your first solution, which is nice. I use 10 iterations.

    I noticed my computer starts to be sluggish with only 5 shots fired on the screen. Is it supposed to be that CPU demanding, or is there some serious optimization work to do in my events ?

  • The first solution suits me well and it's amazingly more accurate than my previous code. I tried the second one but it seems to be very CPU demanding, no way I can use it for my game.

    However, there is still an issue with the first one : the missile still passes through this instead of colliding :

    [attachment=1:2cta8zyl][/attachment:2cta8zyl]

    I tried to increase the loop iterations numbers to 100, 500 or 5000, but it doesn't change anything.

    Any idea ? You can try it on my capx, don't change the current angle and press the N key to shoot at high speed.

    It probably won't be a real issue on the gameplay because we won't shoot at these speed, but I like to learn and understand