How do I give enemies areas specific damage when you click on them

  • hi all I am creating a game where you can hurt enemies when you click on them would it be possible to have area-specific damage like being able to shoot a limb off how would I do this maybe by spawning to other sprites that are hitboxes the same time I spawn the enemy? and pin them to the enemy but that would be tricky since I plan to scale the enemy often since I will be having them walk towards the screen so I would have to scale the hitboxes at the same time..any idea

  • Looks like you answered your own question

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yep, you could use hitboxes. You can make image points in your enemy sprite and attach the hitboxes to these points. Use a every x seconds (like 0.2 or something, you don't need to refresh this every tick/60 times a second - 5 or 10 times a second is enough) condition to update position and scale of the hitboxes. If you enemy has several animation, you would have to set the points for every image in the animation and update the condition with the framerate of said animation.

    Or you could do it like a boss and use a bone animator like spriter pro, which would allow you to build and animate your enemy in body parts. If you import this spriter animation with the construct plugin, you can click on each body part without additional hitboxes.

  • You can do this with image points only. On click, check distance to image point, for example:

    Mouse on Enemy clicked
    If distance(Mouse.x, Mouse.y, Enemy.ImagePointX("LeftLimb"), Enemy.ImagePointY("LeftLimb"))<50 
    	Destroy LeftLimb
    
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)