Coin-coin le Canapin's Forum Posts

  • Hi again :

    http://canapin.com/construct/test/test_swap.capx

    So, I'd like a function which swap every object having "variante = 0" in the decoration family with other objects in this family which have the same name (each door have a variable 'name' = 'door' and same for the trees) and "variante = 1".

    The purpose is beeing able to switch a lot objects with a single function (for example, if I have 50 regular objects and 50 "alt" objects in decorations family...).

    I tried some things but I didn't managed to do it.

    edit :

    I think I'm moving toward a solution. I used the container functionnality. Each element is linked to another element. These two linked elements are on different layers but have the same position. I'll prevent the game to interact with objects on this background layer and I just have to create a function to make them switch their layers, which should be not very difficult.

    http://canapin.com/construct/test/test_swap/

    The moving background A is linked with the red shape B via the container functionnality. They both have the same X Y coordinates.

    The green tree J is linked with the blue tree K. They also both have the same X Y coordinates.

    A and K are on the background layer. They could be invisible too. When I interact with the drag'n droppable grey square, I collide only with the elements on the front layer.

    So, that's it : if I'm able to swap the element layers, that should do the trick. Sorry if my explanations are bad, I'm not that good in english.

  • Hello,

    Thanks for your reply.

    I'll publish a file in a few hours.

    I don't want to use frames or animations, because this kind of element swapping will be available for other and more complicated stuff like enemies (replacing an enemy by another ; same X and Y positon, same animation and same animation frame, etc), which will have their own animations like walk, attack and so on.

    A few years ago, I had the same kind of issue for my shoot'em up, when I wanted to spawn a specific element of a family. The only solution I found on this forum was this one :

    spawn a random object in the family : if not the wanted object (for exemple if variable name != laser if I want an object of 'laser' type), destroy the newly spawn item and try again. If the wanted object, just break the loop.

    That's ugly and slow (especially with a lot of objects in the family), but it kind of works.

  • Hi.

    I'm trying to create a function to swap some elements in my game.

    Basically, I currently have this "obstacle" family :

    wall 1

      name = "wall" type = 0

    wall2

      name = "wall" type = 1

    tree1

      name = "tree" type = 0

    tree2

      name = "tree" type = 1

    rock1

      name = "rock" type = 0

    rock2

      name = "rock" type = 1

    My function would do this : for each 'obstacle' on the layout, replace it with an 'obstacle' having the same name and "type = 1"

    Any idea about how to do that?

  • Hi.

    All is in the title

  • Thank you.

  • This way it will not be mirrored using B imagepoint position as a "symmetry axis".

  • Hi.

    If A is pinned to an imagepoint of the object B, and I mirror B (horizontal symmetry), what is the simplest way to make A following B mirroring?

  • I tried exposure but it doesn't fit at is keep blacks black.

    I tried brightness and it seems to work, with a default value of 100.

    Thank you

  • I want the sprite to be white when hit, not invisible.

  • Hi.

    I'm using a Set color effect (255,255,255) to make my enemies blink when the player hit them.

    However, this effect is active by default and I just want to activate it when the enemies are hit.

    Actually, I've made this event : "on start of layout -> enemy : disable effect "hit".

    Is there any way to set this effect inactive by default without using the event sheet?

  • Hi!

    It took me some time to figure out how to do this with your advice (and to understand the "*1000" purpose), but I finally did it.

    previousWall_X = 0

    previousWall_Y = 0

      For each [wall] order by ( wall.X / wall.Width ) * 1000 + ( wall.Y / wall.Height )
        Pick wall where Y = previousWall_Y + wall.Height --> wall set animation to "block" (different hitbox) (no condition) --> system set previousWall_X to wall.X (no condition) --> system set previousWall_Y to wall.Y

    Thank you very much !

  • Thanks for your replies.

    My object is actually not a kangaroo, but a wall.

    Basically, what I'm trying to achieve is :

    "if a wall A has another wall B directly above it, make A red". I use a grid so my walls are well aligned.

  • Hi!

    Let say I have this :

    For each Kangaroo

    (sub event) For each Kangaroo

    How can I make comparisons between the kangaroos from the first loop and those from the second one?

    I'm tyring to do this kind of stuff since yesterday and it makes my brain hurt.

  • That was right, thanks a lot!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi all!

    I'm trying to custom my "ghost shooter" game from the tutorial.

    Instead of repeatly click the mouse button to shoot, i've done this :

    Then I just have to keep the mouse button down to make my character shoot.

    The bullet is supposed to appear to the character image point "canon", but when I press the mouse button, only the first bullet appears to this point.

    The other ones appear on the center of the character sprite instead of its image point "canon".

    Does someone could help me about this?

    Thank you very much.