Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #=============================================================================
- # Borders
- #=============================================================================
- #Borders prevent the player from crossing past a point in a certain direction
- #Set the event to parallel process, with conditional script Border(point,"direction")
- def pbBorder(point,direction)
- direction = direction.downcase
- case direction
- when "up","down"
- player = $game_player.y
- when "left","right"
- player= $game_player.x
- end
- case direction
- when "up","left"
- return (point < player)
- when "down","right"
- return (player > point)
- end
- end
- #=============================================================================
- # Boundaries
- #=============================================================================
- #Boundaries require the player to stay within the limits given.
- #Set the event to parallel process, with conditional script Boundary(X1,X2,Y1,Y2)
- # Y1
- # X1 (||) X2
- # Y2
- #Set both Xs to 0 for only Y boundaries, and vice versa
- def pbBoundary(x1,x2,y1,y2)
- ret = false
- xonly == true if y1 == y2
- yonly == true if x1 == x2
- xbound = $game_player.x.between?(x1,x2)
- ybound = $game_player.y.between?(y1,y2)
- ret = true if (xbound && ybound) || (xbound && xonly) || (ybound && yonly)
- return ret
- end
- #=============================================================================
- # Ranges
- #=============================================================================
- #pbRange returns true if the player is within a number of tiles from the event.
- #xonly will only check horizontally
- #yonly will only check vertically
- def pbRange(limit,xonly=false,yonly=false,event=@event_id)
- event=$game_map.events[event] if event.is_a?(Integer)
- ret = false
- leftlimit = event.x - limit
- rightlimit = event.x + limit + event.width - 1
- downlimit = event.y + limit
- uplimit = event.y - limit - event.height + 1
- xbound = $game_player.x.between?(leftlimit,rightlimit)
- ybound = $game_player.y.between?(uplimit,downlimit)
- ret = true if (xbound && ybound) || (xbound && xonly) || (ybound && yonly)
- return ret
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement