Distance not working

0 favourites
  • 4 posts
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • I wasn't sure if this was a bug or if I've made an error.

    I'm using the Compare Distance parameter, and everything looks fine to me, but it's not working.

    Here's the capx

    And he's the test of it not working: Test Game

    Here's what my event looks like:

    <img src="http://dl.dropbox.com/u/1605506/Distance.jpg" border="0">

    Basically, when the "locked" door is approached, I'd like the text to display.

  • There's several issues with your capx :

    1/ you can't really know if the event is working, because your text is way out of screen at (70,446) when your character (an then the scrolling) is at about (880,3200). So you need to put your text and text_box in another layer with 0,0 parallaxe

    2/ 10px is too short, your the distance between the hotspot of your character and it's boundaries are already greater than 10px.

    I put < 60 instead

    3/ the system distance() function doesn't do any picking. If you know you'll have only one closed door in all your layout it's ok. But if you want to put more than one, you have to filter each closed door with a foreach and do the distance check afterward.

    Look at the capx. the order of event 23's conditions is important:

    • first filter closed door
    • next take each closed door one by one
    • and then do the distance check on the door the foreach is on

    doorPicking.capx

  • There's several issues with your capx :

    1/ you can't really know if the event is working, because your text is way out of screen at (70,446) when your character (an then the scrolling) is at about (880,3200). So you need to put your text and text_box in another layer with 0,0 parallaxe

    2/ 10px is too short, your the distance between the hotspot of your character and it's boundaries are already greater than 10px.

    I put < 60 instead

    3/ the system distance() function doesn't do any picking. If you know you'll have only one closed door in all your layout it's ok. But if you want to put more than one, you have to filter each closed door with a foreach and do the distance check afterward.

    Look at the capx. the order of event 23's conditions is important:

    - first filter closed door

    - next take each closed door one by one

    - and then do the distance check on the door the foreach is on

    http://dl.dropbox.com/u/23551572/C2/doorPicking.capx

    1) Ah, you're right. Silly mistake ><. I've got it set up correctly in my project file, just not in the capx test file I linked too.

    2) Good to know! Thanks.

    3) Also good to know, I'll give it all a try. However, I want all closed doors to behave the same anyway, so isn't this potentially a non-issue? At any rate I've give it a try with the fixes you've suggested.

    Thanks again, I'll try it myself and let you know how it works out :)

    Oh, and thanks for the fixed capx, works perfect!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you don't use the foreach, the distance check will be with the first instance of the Door. So for the second the check will return false and then the text will never appear.

    So yeah you'll need the foreach if you have more than one door even if the associated action is the same.

    You're welcome.

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