Have problem with the Background

Started by , Wed 23/07/2003 16:04:54

Previous topic - Next topic

NaStY

I have a problem using the Background.
In my game my character use a crowbar on a blocked door,and now I want to make that the door is unblocked,and to change the Bg pic.
to that with the door unblocked ???

SSH

Make the door an object: you can either not have it in the background at all and have a blocked and unblocked sprite version of it, or just have the unblocked sprite go over the top of the background to hide the blocked version (only if it is same size or bigger, obviously)

Or, you could use multiple background and switch backgrounds, as long as you are not animating them.
12

NaStY

Thank you!This would help me,but can you tell me the script command for switching Bg,because I don`t know it,and I can`t find it anywhere ???

Scummbuddy

Check this out in the manual.

SetBackgroundFrame
SetBackgroundFrame (int frame)

Locks the background to frame number FRAME of an animating-background screen. (Values for FRAME are from 0 to 4). This allows you to use the animating backgrounds feature for another purpose - you can have two frames of the background, one for example with a spaceship crashed on it. Then, once the right event has happened, call SetBackgroundFrame in the Player Enters Screen event to set the background before the screen fades in.
Call SetBackgroundFrame(-1) to set the default animating frames.

The frame lock is released when the game changes rooms.

Example:

if (GetGlobalInt(20)==1)
   SetBackgroundFrame(4);

will change the current room’s background frame to 4 if the global integer 20 is 1.
See Also: GetBackgroundFrame
- Oh great, I'm stuck in colonial times, tentacles are taking over the world, and now the toilets backing up.
- No, I mean it's really STUCK. Like adventure-game stuck.
-Hoagie from DOTT

Darth Mandarb

I've used this one before.  I have it so that when you open a door the room brightens up.  What I did was put in multiple (2) background images, not animated, and upon the action of opening the door I run a script:

SetBackgroundFrame(X)

(X) being whatever background frame you wish to use!  So if you put in two frames, 1 with the unaffected object, and 1 with the affected object, you can just switch between the two.

Hope that helps!

Oh, and another thing I do while scripting ('cause I'm still pretty new to scripting) is I just start typing in something that I want ...  For instance.  If I wanted to set the background frame I'll start typing SET and then I check the autofill stuff it offers.  I've often found what I was looking for without having to look through all the documentations/posts/etc.

dm

NaStY

Thank you all,but now I have another problem.The blocked door is Hotspot 4.After seting the second Bg-frame how,can I make the unblocked door to be Hotspot 5  ?I draw Hotspot 4 over 5,and then use the disable hotspot function to disable it,after I change the Bg,but then I can`t use Hotspot 5???Thank you In advance  ;D

SSH

You can't have two hotspots in the same place. Are they identical in size and shape? What you need to do is use one hotspot and then have some other way to determine if the door is blocked or not:

If you set a global int at the point when you unblock the door then:

1) You can set the correct background if you re-enter the room, as it will  reset to the default beckground when you leave the room
2) You can have the hotspot interactions detect the door state:
e.g.
if (GetGlobalInt(20)==1) {
NewRoom(blah);
} else {
Display("The door is blocked and I can't get through");
}
12

SMF spam blocked by CleanTalk