How do you apply collision to one sprite but not the other?

  • I found out agood way of making a enemy jump.

    http://postimg.org/image/ethsvhxbl/

    Here is my layout. I have set the enemy to move left and rigth. I have the solid platfroms lead the enemy into jumping. I have made the platforms invisible so it really looks like the enemy is jumping.

    Here is images showing the enemy jumping.

    http://postimg.org/image/jre2q5mqz/

    http://postimg.org/image/4wbdg6f3l/

    http://postimg.org/image/sjuras3al/

    http://postimg.org/image/pi4l0bt4j/

    The jumping works fine like this.

    http://postimg.org/image/3s0cgsegj/

    But of course so can the player also stand on the platforms and collide whit themso the player avoiding the jumping enemy doesnt work. Is there any way to make it so only the enemy collide whit the platforms and the player doesn't so the jump will be a jump. I would be grateful for help.

    I don't use the Jump platform thing becuase it never works. I have asked for help about it so much and even if i have done exactly as i have been told it still doesn't work. If your answer is about Boooleans tell me how to set them up whit variables, events and actions and such clearly.

  • Answer someone!

  • Again answer someone!

  • You could use a boolean to tell whether the specific object should enable collision or not.

    is bCollision true -> object.setCollisionEnabled = true

    is bCollision false -> object.setCollisionEnabled = false

    Question: Why don't you use the regular platform behaviour to make the enemy jump? instead of using invisible platform sprites?

    Or did I read you question wrong? It was kinda hard to follow.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Again answer someone!

    Sorry, I prefer helping people who ask politely..

    But I hope eliasfrost answer helped..

  • You could use a boolean to tell whether the specific object should enable collision or not.

    is bCollision true -> object.setCollisionEnabled = true

    is bCollision false -> object.setCollisionEnabled = false

    Question: Why don't you use the regular platform behaviour to make the enemy jump? instead of using invisible platform sprites?

    Or did I read you question wrong? It was kinda hard to follow.

    I can't use the platfrom behavior jump becuase it never works even if i do exactly as i have been told on the forums. If you now could give me the answer how to make a enemy jump that actually works that would be good to but making the colloision work for some objects but not others make alot of other things work so i would still want a answer to this. How do you make the boolean work? i am sure you need a instance variable to make the bolean work. Should i name it is bColllision true? After that how should i set up the events and actions? It seems hard to make it loom like you written it. So basically be clearer.

  • To use the platform behavior to make the enemy jump you need to check for reasons to make the enemy jump. In the simple example below the enmy object will move to the right always, and when the enmy object overlaps with the plr at offset the event tells the enmy object to jump.

    With this method there's really no need to use a boolean to check collision because there's no invisible arc to disable collision on.

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