Hello, thanks for visiting GameML, if you are a Game Maker user, this is the site for you, please sign up, or login if you are already a member, or just browse the site! Welcome to GameML!

ATTENTION MEMBERS!!! USERS CAN NOW SIGN UP AGAIN!
Log in

I forgot my password

Search
 
 

Display results as :
 


Rechercher Advanced Search

Site Hits
Free hit counter
These stats started at 0 on July 7th 2009
GameML File Sharing
USERNAME: gamemladmin@gmail.com PASSWORD: gamemlsite Upload Here: http://gameml.iowoi.org/GameML-File-Sharing-h3.htmPlease add only games.
Create A GAMEML BLOG!
Make a Blog on GameML:http://gamemlblogs.wetpaint.com
Keywords


turn object to a point

View previous topic View next topic Go down

turn object to a point

Post by gogame1315 on Fri Jul 10, 2009 8:51 am

This is a code that turns a object to a point. Unlike the function move_towards_point(x,y,sp) this turns the object at the given speed. this may seem simple to do but it is acutely very complicated.

//argument0 is x the point that the object should move towards
//argument1 is y the point that the object should move towards
//argument2 is speed that the object should tern towards argument0(x) and argument1(y)
Code:

{
if (point_direction(x,y,argument0,argument1) >direction&&
    point_direction(x,y,argument0,argument1) <180+direction)
    {direction +=argument2}
else
if (point_direction(x,y,argument0,argument1) <direction-180)
    {direction +=argument2}
else
    {direction -=argument2}
if(point_direction(x,y,argument0,argument1)+(argument2+1)>direction&&point_direction(x,y,argument0,argument1)-(argument2+1)<direction){direction=point_direction(x,y,argument0,argument1)}
}
avatar
gogame1315
GameML Adventurer
GameML Adventurer

Posts : 103
Points : 32365
GameML Reputation : 10
Join date : 2009-07-10
Age : 21

View user profile http://www.yoyogames.com/members/gamesgo1315

Back to top Go down

Re: turn object to a point

Post by 3d on Fri Jul 10, 2009 8:53 am

Wow, good job!

_________________
Creator of GameML, Thanks for Visiting!
avatar
3d
Admin
Admin

Posts : 1227
Points : 42336
GameML Reputation : 66
Join date : 2009-05-31
Age : 35
Location : U.S.A

View user profile http://gameml.iowoi.org

Back to top Go down

Re: turn object to a point

Post by gogame1315 on Fri Jul 10, 2009 9:53 am

thanks.
avatar
gogame1315
GameML Adventurer
GameML Adventurer

Posts : 103
Points : 32365
GameML Reputation : 10
Join date : 2009-07-10
Age : 21

View user profile http://www.yoyogames.com/members/gamesgo1315

Back to top Go down

Re: turn object to a point

Post by 3d on Fri Jul 10, 2009 9:58 am

Your welcome, thanks for joining!

_________________
Creator of GameML, Thanks for Visiting!
avatar
3d
Admin
Admin

Posts : 1227
Points : 42336
GameML Reputation : 66
Join date : 2009-05-31
Age : 35
Location : U.S.A

View user profile http://gameml.iowoi.org

Back to top Go down

Re: turn object to a point

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum