Community
Message Board

Chat room - users
Game Over
( 394431 downloads)
Work In Progress
( 523201 downloads)
Links

Code Exchange
Downloads
Tutorials
Add to Favourites

Submit news

DIV ARENA FORUMS
Not logged in [Login - Register]
Go To Bottom

Printable Version  
Author: Subject: Rotation towards an object, then advancing
Hikaru
DIV Junior
**




Posts: 6
Registered: 21-12-2016
Member Is Offline


[*] posted on 31-12-2016 at 01:05 AM
Rotation towards an object, then advancing


I'm working on a simple game that uses fget_angle to chase down a player in a scroll region (using advance(spd) to move). What I'm trying to accomplish is having the enemy rotate, so that it turns towards the player, so that the "pointy" part of the enemy is facing the player, and THEN moving the enemy towards the player. So far, with my experiments, I've got the enemy spinning as it moves towards the player. I've tried a number of different things but I can't quite get the correct result. Using just fget_angle "snaps" the enemy to the proper angle towards the player, and it looks somewhat hokey to me. Any advice on how to do this? Any help is greatly appreciated.

[Edited on 31-12-2016 by Hikaru]
View user's profile View All Posts By User
MikeDX
DIV Nerd
*********


Avatar


Posts: 8388607
Registered: 25-2-2016
Member Is Offline


[*] posted on 31-12-2016 at 09:43 AM


The function you need is near_angle. Check the help system and try the example program, it does exactly what you want it to do :)
View user's profile View All Posts By User
Hikaru
DIV Junior
**




Posts: 6
Registered: 21-12-2016
Member Is Offline


[*] posted on 31-12-2016 at 11:19 PM


Darn! Don't know how I missed that one! Thanks for pointing it out. It looks quite straightforward.

EDIT: aaaaaand it works! Thanks Mike :)

[Edited on 31-12-2016 by Hikaru]
View user's profile View All Posts By User

  Go To Top

Powered by XMB
XMB Forum Software © 2001-2012 The XMB Group
[Queries: 18]