Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: on Sun 10/09/2006 17:39:01

Title: Create Overlay when Player walks on region [SOLVED]
Post by: on Sun 10/09/2006 17:39:01
Hi Folks,

I've got a little scripting-problem. I want to display an overlay when the player walks onto a specific area.

I painted a region and wrote my code in Interaction "Player walks onto region":


PlaySound(8);
Overlay* overDart = Overlay.CreateTextual(441, 50, 100, 1, 6, "*pffft*");


But in my Test only the Sound is played, but the overlay don't appear.
The same code works fine, when I put it in another Interaction-folder, e.g. "Use button".

Thanks for your hints.

PS: I'm german, so excuse my bad english ;)
Title: Re: Create Overlay when Player walks on region
Post by: Alynn on Sun 10/09/2006 18:56:21
I believe the overlay function uses screen coordnants, so unless your game is 800X600 or 640X480 it will display outside the screen. Since your X coordnant is outside of the screen size.

Also color 6 is very close to black so if your background is black, you won't be able to see it as well (unless your game is 256 colors).

Thats the first thing I can think of without more information on resolutions and what not.

Oh one more thing, if you don't have the overlay variable global, the overlay will dissappear once out of scope, or in other words, as soon as the function for the interaction ends... which on second thought it probably your issue.
Title: Re: Create Overlay when Player walks on region
Post by: Ashen on Sun 10/09/2006 19:12:09
QuoteI believe the overlay function uses screen coordnants, so unless your game is 800X600 or 640X480 it will display outside the screen. Since your X coordnant is outside of the screen size.

Even then I think overlays still use a 320x200 (or 400x300) coordinate system - so x=441 would ALWAYS be off-screen. Try using a lower coord or 441 - GetViewportX() if it's a scrolling room and see if that helps, but I think the 'out of scope' thing will be a problem too.
Title: Re: Create Overlay when Player walks on region
Post by: on Sun 10/09/2006 19:37:20
Yeah, thanks!!  ;D

In fact it was the problem with out of scope. Haven't thought of that.
I added Wait(40) and it works perfectly.