[FIXED] GUI's position in a large room causes game to crash...

Started by Technocrat, Thu 06/09/2012 19:01:59

Previous topic - Next topic

Technocrat

My game has a GUI that, when the mouse moves over it, it jumps out from the side to full length. This has worked well enough so far in most of the rooms, in four games now, but I've run into a problem that I've never seen before. In particular, there's a GUI that's designed to track the position of the sliding inventory, and this is what's been crashing it. When a particular room loads, the game crashes, telling me there's been a problem with this line

Code: AGS
if(SlideInv==false){gSlideLabel.X=gInvSlide.X-300;gSlideLabel.Y=225;}


The room is wider than normal - it's 500 wide, when the rooms are normally 320. When the character appears on the far right, the game crashes. When he appears on the left, the game does not crash. This leads me to suspect that it's something to do with the GUI thinking that its position is out of its range - does anyone have a suggestion about how this can be resolved?

Khris

It's weird, GUIs are positioned using screen coords, so the fact that it's a scrolling room or the player's position shouldn't matter at all.
Could you tell us the exact error message?

Also try intercepting the GUI being entirely off screen and turn it invisible instead.

Technocrat

The error is that "GUI.Y: co-ordinates specified are out of range." Looking at it, I realise now that it's giving me problems about the Y being out of range, which shouldn't even be an issue here, since it gets the same instructions for its Y position no matter what room it enters.

[SORTED] Ah, I figured out that it was because of a completely unrelated matter - turns out the room change had been sending the player to the wrong room, where the whole mechanism for making sure the GUI was in the right place wouldn't happen properly. Thanks for your help, anyway!

SMF spam blocked by CleanTalk