Moving Objects in from Off Screen

Started by dodgethesnail, Thu 01/02/2007 04:49:20

Previous topic - Next topic

dodgethesnail

I am trying to make an opening cutscene so I had a few questions about it:

1. How can I make an object move into a room from somewhere off screen?
2. How do you trigger things such as that to happen in sequence without having to click on anything?

I have tried looking in the manual and on this forum and I did find a few very brief things on starting a cutscene, but I couldn't find anything about moving objects into a room from off screen.
Any help would be much appreciated. Thanks.

Ashen

1.
If you mean 'off screen' as in outside the boundaries of the room (e.g. negative values), you'll need to use Object.SetPosition to place the object to start with. One of the 'Player enters screen' interactions ('Before fadein' or 'First time' are probably best) should be the place for this. Then use Object.Move to - oddly enough - move the object. You might need to use the eAnywhere parameter if the Object is really off screen (no walkable areas for it to move on outside the room boundaries), or if you don't want to set up a Walkable area just for the Object.

2.
Depends on how exactly you want it to work, but generally making sure all the commands use the eBlock parameter where needed should have them run nicely in sequence. If you want them to start when the player enters the room, without them doing anything, the 'Player enters room' interactions are again what you want - this time 'after fadein' is probably best. If there's something else, be more specific about what you want to happen.

Both these answers are easy enough to find in the Manual and BFAQ, with a little thought. Are you having any specific problems with them (e.g. commands not behaving as it seems they should)?
I know what you're thinking ... Don't think that.

dodgethesnail

Okay, man I am so confused. I think I got a little ahead of myself at first so let me start from the beginning here and go very slowly.
So let's say I want the following:

1. I start the game.
2. The screen is completely black for a few seconds.
3. There is a fade in from the blackness to the first room.
4. Nothing happens for a few seconds.
5. An object moves into the room from off screen somewhere (from outside the room boundaries)
6. The object comes to a halt.

Okay so say I want to do what I just described above, and I want all that to happen as soon as you start the game and without having to click on anything. I'm not asking anyone to write the code for me (although you could if you really wanted to, hehe). I know how to use the manual to find the code I need and everything, but I am just having a little trouble getting started and I can't seem to figure out where exactly to put all this code.

I guess the first thing I'd need to know is how to start the game with a black screen. Would I have to have another room that is just a black room, or is there a better way?

Secondly, in my current room1 script, I want it to fade in right? So I put in the FadeIn script in, but it gives me the "unexpected FadeIn" error when I try to test it.  So then I got rid of the FadeIn, and tried starting out with the Object.SetPosition so I could try my hand at moving the object into the room at least, but then if gave me the "unexpected Object" error. I assume there must be some code I have to put in before doing anything at all.

I know this is all very noobish, but if I could just get a simple explanation on how to start out, I think I could figure it out from there. Thanks.

Khris

Open the first room, then click the red i.
2 will go into "player enters screen (before fadein)".
3 is done automatically.
4 to 5 will go into "player enters screen (after fadein)".
6 is done automatically.

The reason: Directly after loading a room, AGS will execute everything in "before fadein", then fade in, then execute everything in "after fadein". No Duh ;)

before fadein:
Code: ags
player.Transparency=100;  // hide the player character
oScriptname.X=-50;  // position Object outside the screen
Wait(3*GetGameSpeed());  // pause for 3 seconds


after fadein:
Code: ags
Wait(3*GetGameSpeed());   // again, pause for 3 seconds
oScriptname.Move(120,100,3,eBlock,eAnywhere);  // move into room ignoring walkable areas


Instead of "oScriptname", use "o" plus the Scriptname you gave the object.
In the editor, position the object at any x-coord and y-coord 100 to make it move in horizontally from the left.

dodgethesnail

Okay that makes a lot of sense. thank you. I will try it out.

SMF spam blocked by CleanTalk