Ray casting question

0 favourites
  • 7 posts
From the Asset Store
Magic Spells (SFX)
$4 USD
60% off
High quality spell, looping and casting sounds for your medieval & fantasy settings
  • So i want to use raycasting to make a sprite check in front of it but i want it to keep a constant distance in front of it such as using Line of site. I want the sprite to stop moving if it has the line of sight to the one in front of it, and move once the one in front of it moves out of its line of sight. I have attempted this with the Line of sight behavior but the sprite will just keep pushing the one in front of it like it can't see it. So i hope with ray casting i can make it to where it will check 25 units in front of it at a time and if it sees a sprite in front of it, it will then stop and wait till the one in front of it moves.

  • cant you just check for overlapping at offset ?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • this works to make them stop thank you! but how do i make them start moving again when the one in front of it dies/moves

  • this works to make them stop thank you! but how do i make them start moving again when the one in front of it dies/moves

    maybe something like

    -if object is overlapping at offset other object -» stop moving

    - else -» move forward

    the contrary might also work

    -if object is NOT overlapping at offset other object -» move forward

    - else -» stop moving

    EDIT: you might need to check the conditions every tick.

  • This Worked! Thank you so much i've been struggling with my movement system for AI for days

  • Wait Now the else statements aren't working , they started to push eachother again

  • Wait Now the else statements aren't working , they started to push eachother again

    did you change anything ?

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