Move object as dialog is happening

Started by paolo, Sun 06/05/2007 20:15:05

Previous topic - Next topic

paolo

In the intro to the game I am working on, I scroll the room from right to left (which is working fine) to reveal a ship on the left, in which a conversation is going on. The user has to click to progress the conversation (although I could change that easily enough).

What I would like to be able to do is for the ship to move gradually as the conversation is going on (and as it comes into view when the viewport scrolls across to reveal it).

I think this should go under "Repeatedly execute" in the interactions list - correct me if I'm wrong. Anyway, I'm running the following script from "Repeatedly execute":

object[SHIP].Move(object[SHIP].X + 1, object[SHIP].Y, 1);
Wait(1);

but the ship does not move at all. The following did not work either:

object[SHIP].X++;
Wait(1);

For the record, my object is named "Ship" and has script name "SHIP". It is also set to be initially visible.

I think I must be missing something obvious here.

Thanks (and I did a search for this topic but didn't find anything, by the way).

Khris

You have to put the animation code in rep_ex_always because conversations are blocking.

paolo

#2
Thanks, that worked a treat. That function is called once per cycle, I see, so the speed of the movement is the same as the speed of the scrollling (although in the other direction).

I took out the "Wait" because that's blocking... is there another way I slow down the scrolling? Is there a global time variable to give the number of cycles elapsed? For example:

if (time % 10 == 0)
{
    //move ship to right one pixel
}

which would move the ship one pixel every tenth cycle. I'm assuming % is the modulo operator in AGS.

I've set up my own variable that repeatedly counts up to 10, and this works fine, but if there is a "time" variable, it would be handy to be able to use that instead.

Khris

Look up SetTimer, DateTime.RawTime and GetGameSpeed.

SMF spam blocked by CleanTalk