Promiment Studios

A forum for my team

Ok, I have decided to make a point system. The more points you have the more your appreciated and trusted.1-5 points I can trust you a little. very little aprreciation5-10 pointsI can trust more than usual. regular appreciation (credits)10-15 pointsI can trust you highly. Moderator20+CO-LEADER

    Moving Towards Point

    Share

    Squiggy
    Admin

    Posts : 12
    Join date : 2009-04-13

    Moving Towards Point

    Post  Squiggy on Mon Apr 20, 2009 6:07 pm

    BASIC
    If you want a object to simply move towards a point or another object heres the code:

    move_towards_point(ball.x,ball.y,5)

    ball is the point you want to move towards, 5 stands for the speed.
    _____________________________________________________________________________________
    If you want a object to move towards a point avoiding SOLID heres the code:

    action_potential_step(ball.x,ball.y,5,0)

    Ball stands for the point. 5 stands for the speed. 0 means to avoid solid objects.

    If you want a object to move towards a point avoiding ALL INSTANCES heres the code:

    action_potential_step(ball.x,ball.y,5,1)

    Ball stands for the point. 5 stands for the speed. 1 means to avoid all objects.
    _____________________________________________________________________________________
    A BIT MORE ADVANCED
    If you want a object to move towards the nearest of multiples of the same object without avoiding other objects heres the code:

    move_towards_point(instance_nearest(x,y,ball).x,instance_nearest(x,y,ball).y,5)

    instance_nearest tells it to move towards the closest of that object. ball stands for the point to move towards. 5 stands for the speed to move.
    _____________________________________________________________________________________

    If you want a object to move towards the nearest of multiples of the same object avoiding SOLID objects heres the code:

    action_potential_step(move_towards_point(instance_nearest(x,y,ball).x,move_towards_point(instance_nearest(x,y,ball).y,5,0)

    instance_nearest tells it to move towards the closest of that object. ball stands for the point to move towards. 5 stands for the speed to move. action_potential_step tells it to avoid the objects. 0 stands for avoiding solid objects.

    If you want a object to move towards the nearest of multiples of the same object avoiding ALL INSTANCES heres the code:

    action_potential_step(move_towards_point(instance_nearest(x,y,ball).x,move_towards_point(instance_nearest(x,y,ball).y,5,1)

    instance_nearest tells it to move towards the closest of that object. ball stands for the point to move towards. 5 stands for the speed to move. action_potential_step tells it to avoid the objects. 1 stands for avoiding all instances.


    I hope this helped, any other questions please pm me.

    Tacopie981--Admin
    Admin

    Posts : 23
    Join date : 2009-04-13

    nice

    Post  Tacopie981--Admin on Mon Apr 20, 2009 6:42 pm

    actually didnt know the last 2! I fell bad =(

    Squiggy
    Admin

    Posts : 12
    Join date : 2009-04-13

    Yeah

    Post  Squiggy on Mon Apr 20, 2009 6:50 pm

    Tacopie981--Admin wrote:actually didnt know the last 2! I fell bad =(
    I figured them out a while back when I was making a defense game like the one that one the yoyogames cooperation competition sunny Think Tam will uderstand this? or some of it?

    Tacopie981--Admin
    Admin

    Posts : 23
    Join date : 2009-04-13

    hmm

    Post  Tacopie981--Admin on Mon Apr 20, 2009 7:16 pm

    maybe the first one

    Sponsored content

    Re: Moving Towards Point

    Post  Sponsored content


      Current date/time is Wed May 23, 2018 4:05 pm