Coin-coin le Canapin's Forum Posts

  • Right, I assumed he wanted to store the PNJ text directly into the object property, I don't know why

  • RamPackWobble : Didn't thought about this condition ! I'll try it.

    Colludium : I prefer not using external plugins or behavior if I can achieve something easily, but I will take a look at it !

    Asmodean : I tried and I mentionned it.

  • If you are using a crosshair or something like this to see where you are going to shoot, you can do something like this if we consider the player angle is used as its vision reference :

    if angle(player.X, player.Y, crosshair.X, crosshair.Y) is between player.angle -45 and player.angle+45 then shoot.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can use the asJSON expression : https://www.scirra.com/manual/133/common-expressions

  • The second solution suggested by RamPackWobble seems the best to me

  • That may be a little off topic, but the thing I don't like about the tilemap object in C2 is the fact that you can't select and move tiles.

    You have to erase them and draw them again.

    For one of my project I drew my maps with a drawing software (photoshop, paint…) where each pixel represented a tile.

    In my C2 project, I loaded the small png of my map into a sprite, which I pasted into the Canvas plugin. Then I iterated over all the image pixels like this :

    if current pixel color is ###### then create this tile at the current coordinates.

    It made my level modifications easier than beeing stuck to the tilemap drawing directly into Construct 2.

  • Use the text box object and a button object.

    Then do this :

    global variable playerName = ""

    on button clicked AND textbox.text ≠ "" → set playerName to textbox.text

    Then to use the variable into a text, write the PNJ text like this :

    « Hi [player], nice to see you again in my unicycle shop ! »

    And do this event :

    pnj.text = replace(pnj.text, "[player]", playerName)

    It will replace [player] by the playerName variable.

    https://www.scirra.com/manual/126/system-expressions is a good place to find stuff like this. <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

  • Hi.

    I want to stuck a moveable hat on my character. My character has an imagepoint "head" which is different for each animation frame.

    I want my sprite hat always beeing on this imagepoint regardless the animation frame.

    I tried the simplest way, as a each tick -> set hat position to character imagepoint

    But it doesn't work as the hat is always 1 frame late and seems to "follow" the head instead of beeing pinned on it.

    Actually I'm using this :

    each tick ->

    • hat Pin Unpin
    • set hat position set hat position to character imagePoint
    • hat Pin pin to character

    It does the trick but seems ugly to me.

    Is there a more proper way to achieve this ?

  • You can store conditions into functions as well.

  • Thank you very much

  • Hi.

    The linked files don't exist anymore and I'm trying to achieve this effect. I want the player bounce off the enemi when jumping or falling on its head, but not if it touches the enemy from the side.

    I tried something like :

    Player -> is overlapping enemy at offset (0, 1)

    Player -> is NOT overlapping enemy at offset (0, -5)

    But it doesn't work as expected. It limits the player from bouncing on an enemy when coming from the side but it doesn't totally prevent it, and if the player if falling at high speed, it passes the Y -5 offset and doesn't bounce on the top of the enemy.

    Any idea ?

  • Well I used a function which is called at each tick and when the player width changes and it works perfectly. \o/

  • Okay I managed to make it working with this :

    There is still one issue thought. If the player is still, overlaps both an indestructible and a destructible block and his width suddently decreases, making him overlapping only the destrutible block, it doesn't trigger the condition and the destructible block is not destroyed. I guess I should put these conditions in a function I call at each tick but also each time the player width changes…?

    edit : forgot to link the picture

  • I already tried this but it doesn't work for the two first pictures I posted : if the player is overlapping at y=1 a cracked block BUT also overlapping at y=1 an indestructible block, then the destructible block shouldn't be destroyed.

  • Hi.

    I'm trying to achieve a well known effect in platformer games where cracked blocks are destroyed when the player walks on them.

    A destructible block should be destroyed only if :

    The entire player hitbox touches it, OR any part of the player hitbox touches it as long as the remaining hitbox touches another destructible block.

    If the player keeps running on a bridge made of destructible blocks, they should be destroyed one after the other as the player run over them (like with a 0.5s delay).

    Any idea how to achieve this ?

    The last picture represents what would happen if the player spawns directly on the center destructible block and if its hitbox is smaller.