How do I check for 2 of the same object different IDs.

0 favourites
  • 5 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • I understand the idea behind UID's and IID's but I haven't figured out how to implement them correctly and I believe that's what I need here.

    My goal is to make it so when the slime and hero object are nearby they enter fight animation, then during animation stage 2 damage happens. [This works but it might explain my image below]

    When a second slime shows up the damage correctly gets put on to him but I can't get it to show above him. Closest I have come is with this code, but it seems the sub event counts the object as touching itself and I can't find a way to check if Slime UID 4 is touching Slime UID 18 to verify.

  • So if there are 2 slimes overlapping the Hero, you need to show another text with damage? What if there are 3 or more slimes?

    I think what you need is something like this:

    Hero on frame change
    Hero animation frame=2
    Hero animation "Attack" is playing
    Slime is overlapping Hero
    	System for each Slime
    		Slime subrtact Hero.attack from Health
    		Slime spawn DamageText
    		DamageText set text to Hero.attack 
    		DamageText Move to (140+loopindex*20, 310)
    
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Worked like a charm!

    Now I just need to get the damage to show up on top of the slimes.

  • After "Spawn" you can move the text up. Or instead of spawn use "Create object" at X=Slime.x, Y=Slime.y-20 or something like that.

  • Ya, I'm using slime.bboxleft but its still off to the right... Slime.bboxleft - 20 is working, so Ill see what issues that'll give me later down the road ;D

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