Simple Movement Checker Plugin

coolperez8

Veteran
Veteran
Joined
Mar 23, 2016
Messages
159
Reaction score
12
First Language
English
Primarily Uses
So, basically this is a simple movement checker plugin. What it does is it adds a script call you can use to check if a certain block relative to the player/events position is passable or not. Here is an example of the commands it should add. Note that I'll be referring to the player/event as the "instance":


chkpass(x,y,direction)




There should also be an alternative version of the script call which reverses the X and Y values if you wish to go that way.


chkpassi(y,x,direction)




Here's how it works:


 The direction determines if it's direction oriented or not. It can be true or false. If it's true, it will actually calculate what co-ordinates to check instead of calculating the ones given based on what direction the instance is facing. You can also put 'left','right','up','down' instead, and it will calculate for that direction. Putting false is equivalent to putting 'up'.


  Here's how it calculates the co-ordinates to check. (Sorry if there's flash backs to geometry class, I know some people hate math, but it's essential in programming, and personally I like math, also, sorry if I made errors in my calculation, please correct me if I'm wrong. :D )


    Up - (x,y)


    Down - (-x,-y)


    Left - (y,-x)


    Right - (-y,x)


Now, here's some example usage:


Let's say the player is facing right, using this script call will check if the space in front of him is passable and return the correct result.


$gamePlayer.chkpass(0,1,true);


Let's say an event is facing in any direction and is running the code, but you want the plugin to assume the event is facing down, this script call will check if the tile below the event is passable, and set switch 1 to the correct result.

Code:
$gameSwitches.setValue(1, $gameMap.event(this.eventId()).chkpass(0,1,'down'));
 

Ossra

Formerly Exhydra
Veteran
Joined
Aug 21, 2013
Messages
1,076
Reaction score
856
First Language
English
Primarily Uses
RMMV
Hmm, you could do that already with the core code. $gamePlayer.canPass(x, y, direction) or $gameMap.event(eventId).canPass(x, y, direction).
 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,047
Messages
1,018,540
Members
137,834
Latest member
EverNoir
Top