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!

Join the forum, it's quick and easy

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!
Would you like to react to this message? Create an account in a few clicks or log in to continue.
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: https://gameml.forumotion.com/GameML-File-Sharing-h3.htmPlease add only games.
Create A GAMEML BLOG!
Make a Blog on GameML:http://gamemlblogs.wetpaint.com

turn object to a point

2 posters

Go down

turn object to a point Empty turn object to a point

Post by gogame1315 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)}
}
gogame1315
gogame1315
GameML Adventurer
GameML Adventurer

Posts : 103
Points : 56385
GameML Reputation : 10
Join date : 2009-07-10
Age : 28

http://www.yoyogames.com/members/gamesgo1315

Back to top Go down

turn object to a point Empty Re: turn object to a point

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

Wow, good job!
3d
3d
Admin
Admin

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

https://gameml.forumotion.com

Back to top Go down

turn object to a point Empty Re: turn object to a point

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

thanks.
gogame1315
gogame1315
GameML Adventurer
GameML Adventurer

Posts : 103
Points : 56385
GameML Reputation : 10
Join date : 2009-07-10
Age : 28

http://www.yoyogames.com/members/gamesgo1315

Back to top Go down

turn object to a point Empty Re: turn object to a point

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

Your welcome, thanks for joining!
3d
3d
Admin
Admin

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

https://gameml.forumotion.com

Back to top Go down

turn object to a point Empty Re: turn object to a point

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

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