Jump to content


Photo

Help With 'step Towards Point'


  • Please log in to reply
7 replies to this topic

#1 ngc0202

ngc0202

    GMC Member

  • New Member
  • 190 posts

Posted 28 February 2010 - 03:42 PM

I am making a game, and I used the D&D function called Step Toward Point avoiding solid objects. The problem is, when a solid object is between its goal and itself, it doesn't avoid the solid object, it goes toward the goal until it collides with the solid object and moves around it. Is there any way to make it so it actually AVOIDS the solid object.
  • 0

#2 @Alex@

@Alex@

    Retired GMC Reviewer

  • Reviewer
  • 3071 posts
  • Version:Unknown

Posted 28 February 2010 - 04:03 PM

I'm not sure about D&D having not used it in years. But you should look into the mp_potential_step function in the manual. It can be used to do actually what you want.
  • 0

#3 ngc0202

ngc0202

    GMC Member

  • New Member
  • 190 posts

Posted 28 February 2010 - 04:13 PM

I'm not sure about D&D having not used it in years. But you should look into the mp_potential_step function in the manual. It can be used to do actually what you want.

That is the GML equivelent of the function I used...so it doesnt work.
  • 0

#4 @Alex@

@Alex@

    Retired GMC Reviewer

  • Reviewer
  • 3071 posts
  • Version:Unknown

Posted 28 February 2010 - 04:20 PM

It works for countless people including myself therefore the only conclusion is that you are using it wrong. It is possible these solids are not solid. Have you ticked the solid box in the object edittor.
  • 0

#5 ngc0202

ngc0202

    GMC Member

  • New Member
  • 190 posts

Posted 28 February 2010 - 04:33 PM

How would I put:
perform a step towards position (NPC.x,NPC.y) with speed 5.1 avoiding solid only
into GML?

PS. The walls are definately solid.
  • 0

#6 @Alex@

@Alex@

    Retired GMC Reviewer

  • Reviewer
  • 3071 posts
  • Version:Unknown

Posted 28 February 2010 - 04:42 PM

mp_potential_step(x,y,stepsize,checkall) // This is the function in its basic form

mp_potential_step(NPC.x,NPC.y,5.1,false)//This is the function with the arguments you need.Change false to true if you want to avoid non-solids as well.
  • 0

#7 ngc0202

ngc0202

    GMC Member

  • New Member
  • 190 posts

Posted 28 February 2010 - 04:55 PM

mp_potential_step(x,y,stepsize,checkall) // This is the function in its basic form

mp_potential_step(NPC.x,NPC.y,5.1,false)//This is the function with the arguments you need.Change false to true if you want to avoid non-solids as well.

I inserted that code replacing the D&D and it did the same exact thing, it wasn't avoiding it, it was going towards its target until it hit a solid, then it went along the solid, always touching it until it could get around. But that is far from AVOIDING solids.
  • 0

#8 thados

thados

    GMC Member

  • New Member
  • 1 posts

Posted 06 March 2011 - 11:24 PM

as far as i know this behavior is as good as its going to get with game maker unless you program a more sophisticated AI. The function you are using is very simple and takes a step toward the point given without looking for a fastest possible route.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users