Walking off screen in a straight line

Started by jrl2222, Tue 03/08/2004 14:18:23

Previous topic - Next topic

jrl2222

Okay I have my main character so we walks off the screen like in quest for glory. I used the MoveCharacterBlocking(EGO,174,230,1);
My question is how do I script it so that instead of walking to 174 he walks straight down from where ever he is on screen.
I want to query Ego's x position and then place that value in the x position of of the MoveCharacterBlocking command.

Proskrito

pass the player character's x coordinate as x parameter in the function

jrl2222

I couldn't find where to get the players x coordinates though.
What is that command?

Ashen

MoveCharacterBlocking(EGO,player.x,230,1);

Which works if EGO is the player character, or the longer way,  for NPC's:

MoveCharacterBlocking(EGO,character[EGO].x,230,1);
I know what you're thinking ... Don't think that.

jrl2222


jrl2222

Okay here is another one then. I have the walk off screen all pretty and working right. But how do you make the character walk unto the screen.
I mean as in the same thing start off screen and walk on. I could probably do it if it was just one entrance but lets say you have a forest screen and want the character to enter from 4 locations east, west ,north, and south.
I want the character to walk on the screen from off screen depending on which previous room he is coming from.
Wait never mind I think I saw that in the demo and I will post here the results if I find it.

jrl2222

Okay I got it
if (character[EGO].prevroom==2) MoveCharacterBlocking(EGO,174,220,1);

So to summarize
In room interaction editor I used
Walk off bottom screen edge -> Run script
I placed this in the script
Code: ags
MoveCharacterBlocking(EGO,player.x,280,1); //Move character off screen straight down from where you are

I also put in under Walk off bottom screen edge
Player - Goto a different room (at specific co-ordinates) (room#,X,Y);
This does a nice job of moving the character off the screen like in the quest for glory games

Then to move the character back on the screen when entering from another room.
First use
Player - Goto a different room (at specific co-ordinates) (room#,X,Y);
on the room that you are coming from and set the x,y location to off the screen in a straight line from where you want your character to end up on the screen.
I then used
Player enters screen (after fadein) -> run script
and place this in the script
Code: ags
if (character[EGO].prevroom==2) MoveCharacterBlocking(EGO,174,220,1);


This seems to work very well.

jrl2222

Wow this might be a good thread when I am done with all the questions.
I have everything working great except now if you walk off the previous screen at a scaling of say 50% you walk onto the new screen with that scaling until you hit a walkable area. How do I set teh characters scaling before he hits the walkable area? I tried to even have the previous room place him on the walkable area in the new room then before fadein move the character off screen and then after fadein move him back where I want him.
Still didn't work.
Could I possibly change his baseline to the top of his head ...no that won't work because then the scaling would continue while he was walking on and he would scale down as he walked on screen then if I changed the baseline back he would scale accroding to where his feet are...if I am thinking right on that.
Is there a way to set the scaling to lets say 75% as the character walks onto the screen from an area that isn't really a walkable area?

Ashen

SetAreaScaling (0, 75, 75);

Should do it, probably best in the Player enters screen (before fadein), otherwise you'll see EGO at the older scaling for a second before it changes.
Also, you could use the if (character[EGO].prevroom==2 line to set different scaling depending on where EGO enters the screen.
I know what you're thinking ... Don't think that.

jrl2222

Thanks again. Works like a charm.
I saw that command but I didn't think it was what I wanted for some reason.
This is really starting to look like something now.
;D

SMF spam blocked by CleanTalk