- Joined
- Jun 26, 2012
- Messages
- 209
- Reaction score
- 9
- First Language
- English
- Primarily Uses
Hi guys..... so i finally got my swimming sprite for my character...so i am using this common event to change actor's graphic.....
So... i wanted to trigger an event as soon as the player reaches the water saying... " do u want to swim " or something like that and then the player jumps and then the graphic changes... so i can use Victor sant's jumping script but how do i use it with this common event
CHANGE ACTOR GRAPHIC DEPENDING ON LOCATIONThis event is just as simple as the previous one. What it does is change the actor's graphic depending on their location - so if they are swimming it will automatically change to a swimming graphic, and back to a walking graphic if they go on land.
The first step is to create a common event named Swimming (or whatever you want) with a Trigger: Parallel Process and a Condition Switch: Swimming. You will need to set three variables: one for the player's X value, one for the player's Y value, and the last to hold the location info value (you can reuse the ones in the previous code if you're using them both). The code inside the event should be as follows:
Control Variables: [0001:X] = Players Map X
Control Variables: [0002:Y] = Players Map Y
Get Location Info: [0003], Terrain Tag, Variable [0001][0002]
Conditional Branch: Variable [0003:Location Info] == 1
Change Actor Graphic: [Eric], 'swimming eric', 0, 'Actor4', 0
Else
Change Actor Graphic: [Eric], 'Actor4', 0, 'Actor4', 0
Branch End
And that's the entire code! Now you have two more steps, but they are relatively easy. The first is to go to tileset -> terrain tag and denote whatever tiles you want to change the graphic while on. I used the coast tiles in the A tab. The second step is for you to change the passage setting for those tiles so the player can freely enter and exit them. And that's it! You can use the darker ocean tiles as a border to keep the player from swimming too far into the water, and If you want to keep the player from swimming entirely, simply flip the Condition Switch: Swimming off.
The first step is to create a common event named Swimming (or whatever you want) with a Trigger: Parallel Process and a Condition Switch: Swimming. You will need to set three variables: one for the player's X value, one for the player's Y value, and the last to hold the location info value (you can reuse the ones in the previous code if you're using them both). The code inside the event should be as follows:
Control Variables: [0001:X] = Players Map X
Control Variables: [0002:Y] = Players Map Y
Get Location Info: [0003], Terrain Tag, Variable [0001][0002]
Conditional Branch: Variable [0003:Location Info] == 1
Change Actor Graphic: [Eric], 'swimming eric', 0, 'Actor4', 0
Else
Change Actor Graphic: [Eric], 'Actor4', 0, 'Actor4', 0
Branch End
And that's the entire code! Now you have two more steps, but they are relatively easy. The first is to go to tileset -> terrain tag and denote whatever tiles you want to change the graphic while on. I used the coast tiles in the A tab. The second step is for you to change the passage setting for those tiles so the player can freely enter and exit them. And that's it! You can use the darker ocean tiles as a border to keep the player from swimming too far into the water, and If you want to keep the player from swimming entirely, simply flip the Condition Switch: Swimming off.


