Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A Sprite That Follows The Player Or An Event
#1
A Sprite That Follows The Player Or An Event
by Near Fantastica
Feb 4 2005

This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.


Howdy,

First off this is simple and almost silly and I am not sure if someone has done this before…

To make a sprite follow a player or event in the script is not an easy thing as anyone who has tired to will know... It works fine for 20 by 15 maps but as soon as you get bigger then that you quickly lose the sprite…

In making the ABS i had just this problem and was tormented by it… so I sat down and work out how to by sovle this problem and here is the answer…

For sprites that follow the player use this

Code:
@display.x = ($game_player.real_x - $game_map.display_x) / 4
@display.y = ($game_player.real_y - $game_map.display_y) / 4


For sprites that follow an event use this

Code:
@display.x = ($game_map.events[Event Id].real_x - $game_map.display_x) / 4
@display.y = ($game_map.events[Event Id].real_y - $game_map.display_y) / 4


@display can be any sprite you have defined just change @display to what you are using…

For those of you a little lost this sprite changes the @display xy to follow the player xy or event xy… in doing so you can have Hp bars that follow the character around… maybe you want to have a Fairy follow the character… or the characters name… all of these things can be done using this code…

Note :

This displays the sprite at the base of the character and you will need to add or subtract a constant to move the sprite just where you want it…

Take Care,
Near
}


Possibly Related Threads…
Thread Author Replies Views Last Post
  Set Event Location Randomly xackery 0 2,241 05-08-2009, 01:00 PM
Last Post: xackery
  New Event Location System Ánemus 0 2,259 08-29-2008, 01:00 PM
Last Post: Ánemus



Users browsing this thread: