| Home | About | Account | Forums | Games |
| Guest | Login |
|
Index
| Recent Threads
| Register
| Search
| Help
| |
![]() |
Forums » List all forums » Forum: Tutorials and Help » Thread: Static location for sprites on a VirtualMediaPanel |
|
Thread Status: Normal Forum Status: Locked Total posts in this thread: 1 |
[Add To My Favorites] [Watch this Thread] |
| Author |
|
|
hdctambien
Stranger ![]() Joined: Sep 25, 2006 Posts: 4 Status: Offline |
I have a fancy map that scrolls using the VirtualMediaPanel's setViewLocation() function and all my sprites go where they are supposed to go and everything is happy making. BUT... I would also like to have some buttons that sit on top of the map and just chill there, like a Heads Up Display. I'm using sprites for the buttons and I can detect when they are being clicked and whatnot, but when the virtual media panel scrolls, so do the HUD buttons. I've tried using the viewLocationDidChange() function inside my Sprite subclass to call the sprite's setLocation() function to move my buttons so that they appear in the same place after the view moves. That didn't work. I also tried keeping a list of button sprites in my BoardView class and overwriting the setVewLocation() function so that when it gets called it loops through the button sprites and calls their setLocation() functions with the offset coordinates. That also didn't work. In both of the above cases when the map is in its original position, the buttons display correctly. When you scroll the map, the buttons all disappear. But if you scroll the map back to its original position the buttons all come back again. I have found one method that works (but it is not to my liking). If, when I call setViewLocation(), I remove the sprite from the spriteManager, then create a new sprite object and give that sprite the new coordinates and add it to the sprite manager, the buttons appear in the right places. But I would rather MOVE my buttons than create new ones every time the map scrolls. I've tried calling invalidate() all over the place and being very specific about which rectangles are dirty, but I can't get anything other than a completely new Sprite to display at the right place (I've tried removing the sprite, setLocation()ing it, and then adding it back again...that don't work) I've also been trying to figure out a way to "layer" MediaPanels on top of each other so I could scroll the MapLayer and leave the HUD layer alone, but I haven't dug too deep into where the paint()ing gets dispatched (somewhere in PlacePanel maybe?) Can anyone point me in the right direction for getting a HUD to display over a scrolling VirtualMediaPanel? |
||
|
| [Show Printable Version of Thread] |
| Powered by mvnForum 1.1 dev (Build: 15 April 2006) - Copyright © 2002-2006 by MyVietnam.net |
