Jump to content
Sign in to follow this  
RavenBlueIndigo

Directional Events

Recommended Posts

Hello. I need a script that makes it so certain events are unable to move vertically and can only move horizontally(left/right).

Share this post


Link to post
Share on other sites


# Use the following in script call within move routes.

# move_horizontal_saplon                                                     #for random movement

# move_toward_character_saplon($game_player)                #for moving toward player

# move_away_from_character_saplon($game_player)         #for moving away from player

 
 
class Game_Event
  
  def move_horizontal_saplon
    move_straight(4 + rand(2) * 2, false)
  end 
  
  def move_toward_character_saplon(character)
    sx = distance_x_from(character.x)
    if sx.abs
      move_straight(sx > 0 ? 4 : 6)
      move_straight(sx > 0 ? 4 : 6) if !@move_succeed && sx != 0
    end
  end
  
  def move_away_from_character_saplon(character)
    sx = distance_x_from(character.x)
    if sx.abs
      move_straight(sx > 0 ? 6 : 4)
      move_straight(sx > 0 ? 6 : 4) if !@move_succeed && sx != 0
    end
  end
  
end
 
 

Here I threw this together real quick.

Edited by Stapleton

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted