じ☆ve冰风 发表于 4 天前

How to Make a Swinging Vine event(s)

Alright everyone. I spent a lot of time trying to figure out a way to do an event where a character jumps on a vine, swing across it, and jumps to the other end. I'm still tweaking things but I pretty much figured out the basics and figured this would be a great opportunity to give back to the community. To help with this little tutorial (and since I'm using it in my game anyway and I'm lazy) I've enlisted the help of Will from my own game to help guide us. Will, how do you feel about this tutorial?





Most likely, but I'm sure you'll be a good sport.

What you will need:

- RPGmaker MV (or anything compatible with Yanfly's Move Route Core Plugin)
- Yanfly's Move Route Core plugin

So the first thing you need is an event that records the player location and also the location of the vine. Some people have a common event for this already to record general movement for things like bridges, general movement tracking etc.

For me, I really only needed it for this one thing, so I made it an event on the map itself. so what you do is you create an event, make it a parallel in that event, set 4 variables, You can name them whatever you want, but for the sake of sanity, I'll name mine player x, player y, vine x, vine y like this.





when you set your x and y variables, you want to go to game data





Click game data on left and it will pull the window on right. For player x, set to map x. Player y set to map y. This will make it so it's constantly recording the horizontal and vertical location of your main character.

For vine x and y variables, you want to set it to the name of whatever you name your vine event to be. So lets say I have a vine sprite and I name it Vine1A, well then I'd go in this same window and set "Vine1A" under character and set to Map x for the Vine X variable, and then do the same thing for the Y, set map Y to Vine1A for VineY variable.





You may be wondering why I have a vine1A. Well, basically vines are long, right? So I actually have a vine that's 2 tiles long. They both move in sync with each other as part of this. Within reason you can make your vine longer. Regardless of how many tiles long your vines are, you only need to get the x and y of one of those tiles. Once you have the parallel event grabbing the x and y locations of both player and vine, then it's time for step 2.





Oh I'm dead serious.





So the layout I have is these three events. Our player is going to jump on the vine. The two (or three or however many you want) vine events will swing back and forth in tandem, and the player can hit a button at any time to jump off of it. If they hit the button at the wrong time, the fall will miss and the player will hit the ground. If they succeed they make it over to the vine on the other end. Let's look under the hood at these events in detail.

First we have our invisible event on the left. Page one looks like this:



So we set page one to touch. we set the choice to if they want to jump or not. If they do, then gather followers and turn followers off temporarily, (that way your followers aren't trailing behind while you swing) and then we do the movement route for the jump. Then we wait, then we turn on the vine switch. The vine switch is what will trigger the vine to do the swinging motion. Since nobody is on it up until that point, it isn't swinging then. Page 2 of this event is the one doing the lion's share of the work. Before I show page 2 for this, let's look at the vine events real quick:



This leads us to
This is page one of the bottom part of the vine. This is the vine when it's not moving. Page two looks similar except for a few things.





1) The trigger is set to parallel. 2) The "On Vine" switch triggered from the invisible event is a requirement here. 3) the vine is set to do a repeated custom route. For the top half of the vine, you basic repeat both of those two prior event pages. The final step is the second event page for our invisible event, which is where all the fun eventing and coding goes in. Before I continue, I'm going to break this up into a multi post thing, because I don't know if there's a post size or image limit per thread post or not...


本贴来自国际rpgmaker官方论坛作者:PersistentDreamerGames处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/how-to-make-a-swinging-vine-event-s.164986/
页: [1]
查看完整版本: How to Make a Swinging Vine event(s)