- Joined
- Aug 16, 2014
- Messages
- 54
- Reaction score
- 11
- First Language
- French
- Primarily Uses
Hello,
I'm creating a system complety with events. It's quite complicated to explain (and my english suck) but I'll do my best.
Here is what I want to do :
In my game the hero get some kind of wierd object ( shown as a hud ) that look like a watch but that actually works like a compass. Every time the player press a certain key, the watch hands of the "watch" turns (exactly like the ones of a real watch but way faster) until they point the direction of the player's goal in the map (in game, this "goal" is an event.)
I'm sure it is possible to do with events but I already tried and failled : It's not working correctly.
The watch hands are turning almost non-stop randomly and are not pointing the right direction.
So I'm here and I hope someone can help me.
To locate precisly in wich direction the "goal" is from the player, you need to use degrees. Since RPG don't do that easily, I had to request a script.
@Source did a great one (to put above main in the script section):
class Game_Interpreter def angle_from_player(id) event = $game_map.events[id] ((Math.atan2(event.y - $game_player.y, event.x - $game_player.x) * 57.29577951308232) % 360).to_i end end To use with this script call code to got into a variable the angle:
p angle_from_player(id)With (id) being the ID of the event, "goal"
Also, since the watch hands are pictures, you need to rotate them to point a direction. And Rpg maker can't rotate picture to a certain angle.
So, again, I use a script to do that (To put anywhere in the script section "Game_Picture") :
def set_ang(angle) @angle = angle end To use with the script call :
$game_map.screen.pictures[id].set_ang(value)With [id] being the ID of the picture to rotate and (value) the degrees. (Note that to make the degrees increase clock-wise you, curiously, need to substract them. for example : -34° instead of 34°.)
And now here are my events :
This is an event on the map.
https://www.dropbox.com/s/k0bq6vgpql4bb8f/screen%20shot1.png?dl=0
And theses two are common events.
https://www.dropbox.com/s/xce9d617ruxhpas/screen%20shot2.png?dl=0
https://www.dropbox.com/s/6gmtytwbrlsepau/Screen%20shot3.png?dl=0
Finaly, here is a demo of my game, so you can see what's making not working my system with event and even change it to make it work better.
I'm still working on this so it's a complete mess ( a part of the system on event, another part on a common event... etc).
https://www.dropbox.com/s/b5r85a0jd53ggv7/Watch%20sytem%20test.exe?dl=0
Now you have everything you need to understand how my system works so I hope you can help me.
Thanks for taking the time to read this.
I'm creating a system complety with events. It's quite complicated to explain (and my english suck) but I'll do my best.
Here is what I want to do :
In my game the hero get some kind of wierd object ( shown as a hud ) that look like a watch but that actually works like a compass. Every time the player press a certain key, the watch hands of the "watch" turns (exactly like the ones of a real watch but way faster) until they point the direction of the player's goal in the map (in game, this "goal" is an event.)
I'm sure it is possible to do with events but I already tried and failled : It's not working correctly.
The watch hands are turning almost non-stop randomly and are not pointing the right direction.
So I'm here and I hope someone can help me.
To locate precisly in wich direction the "goal" is from the player, you need to use degrees. Since RPG don't do that easily, I had to request a script.
@Source did a great one (to put above main in the script section):
class Game_Interpreter def angle_from_player(id) event = $game_map.events[id] ((Math.atan2(event.y - $game_player.y, event.x - $game_player.x) * 57.29577951308232) % 360).to_i end end To use with this script call code to got into a variable the angle:
p angle_from_player(id)With (id) being the ID of the event, "goal"
Also, since the watch hands are pictures, you need to rotate them to point a direction. And Rpg maker can't rotate picture to a certain angle.
So, again, I use a script to do that (To put anywhere in the script section "Game_Picture") :
def set_ang(angle) @angle = angle end To use with the script call :
$game_map.screen.pictures[id].set_ang(value)With [id] being the ID of the picture to rotate and (value) the degrees. (Note that to make the degrees increase clock-wise you, curiously, need to substract them. for example : -34° instead of 34°.)
And now here are my events :
This is an event on the map.
https://www.dropbox.com/s/k0bq6vgpql4bb8f/screen%20shot1.png?dl=0
And theses two are common events.
https://www.dropbox.com/s/xce9d617ruxhpas/screen%20shot2.png?dl=0
https://www.dropbox.com/s/6gmtytwbrlsepau/Screen%20shot3.png?dl=0
Finaly, here is a demo of my game, so you can see what's making not working my system with event and even change it to make it work better.
I'm still working on this so it's a complete mess ( a part of the system on event, another part on a common event... etc).
https://www.dropbox.com/s/b5r85a0jd53ggv7/Watch%20sytem%20test.exe?dl=0
Now you have everything you need to understand how my system works so I hope you can help me.
Thanks for taking the time to read this.
Last edited by a moderator:





