![]() |
Feedback: Single player minimap
1 Attachment(s)
I've been playing around with a lot of areas within GScript that I've never properly looked at before such as SQLite storage methods and more advanced uses for maths. This task was more to do with using maths for more than just placing GUI controls across the screen, and took some thinking on my part.
I've managed to script a simple minimap script that shows your player's position on the map. It works by taking how many levels your GMAP is made up of and finding how many tiles are in those levels added up. It then positions an image on the map image according to the player's location. It works, I know that, but I'm just curious as to if there's a simpler way to go about doing this. I looked briefly at Dusty's minimap script after finishing this, and his approach is somewhat different to mine. Any feedback, criticism and advice is welcome as long as it's constructive. Thank you. (I had to use pastebin.graalcenter.org since incapsula wouldn't let me post the code) Minimap code (pastebin.graalcenter.org) |
Just on a readability note, you should make constants like this.mapimage and this.scale actually constants:
PHP Code:
You should probably also set profile.modal = false; on the mini map control (MapContainer) so it can't accidentally steal focus from the client. And a 0.05 second timeout is almost certainly not necessary. Ideally you'd only calculate the position a couple times per second or less, and only when the player has moved. |
Thanks for the feedback.
I'm now using constants to store the data instead of this. variables, the control no longer steals the focus from the GraalControl and I'm only checking for the player's position every second now. Sorry for the slow reply. |
Good work! I see you're improving since you started scripting.
|
Quote:
|
| All times are GMT +2. The time now is 05:54 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.