Hi
I'm trying to script if player is facing east or west (Not just facing location X and Y).
I have 2 views the same accept facing different directions.
if player facing east change view to this else if facing west to this view.
Because in each view you have only 1 up, 1 down etc etc and I need 2 downs, ups etc
So, if player facing east change down view to this else this view if facing west.
Something along these lines.
Thanks if you can assist me
cheers
I'm not sure whether I get what you want to do, but can't you just check the value of the player.Loop property to see to which direction he's currently facing?
Iceboty
imagine: if character fly's up facing east, he need to be facing east when coming down.
Else if character fly's up facing west, he need to be facing west when coming down.
hope this explains better
cheers
I haven't checked, but I think if you only add frames to the L/R loops, and leave the other loops empty (or only the idle frame? I'm too lazy to check the manual at the moment, so please verify) the EXACT effect will be achieved.
Hi
Whilst Player is on region 1 (bottom of screen) and presses J the view changes and a walkable area is restored allowing the player to fly up the screen. When he drops down to region 1 on the bottom of the screen his view changes and will look the way he came down ie left or right.
I have View3 (left and right) for when player is at the bottom of the screen and View 4 (left) and View 5 (right) for when rising up the screen.
(http://i1181.photobucket.com/albums/x423/qikfire/lockview.png)
I have been trying lockview.
So far it is almost there. Just one part to tweek.
Can you think of the best way to implement this as per drawing?
cheers
You need player.ChangeView() (http://www.adventuregamestudio.co.uk/manual/Character.ChangeView.htm).
Hi Khris
its not as easy as that in this case.
When J key is pressed the player changes view and a walkable area is restored which allows player to rise up the screen in the new view.
However, the main thing I am trying to achieve is the up and down loop.
That is to say, rising and going right and then coming down will be different from rising, going left and coming down. Both ways need to face direction of going to from the minute of J presses and the change view.
At the moment I have 2 views for rising which is determined by player facing location as to which 1 is activated when J key pressed. (As in image above.)
I could of course stay with the normal, everyday views with up and down views but I'm trying to push a bit for continuity and effect as well as adding knowledge.
Also when you lower the character back down the screen a region returns the view to normal and the player faces same direction as decent.
So far, what I have works accept take off,when one of the view directions on J key press faces wrong direction at start.
What I have so far and it seems to work:
function region1_WalksOnto()
{
cChar1.ChangeView(3);
RemoveWalkableArea(2);
}
//MAKE CHARACTER JET PACK
}
if (keycode == 74 && player.View==3 && player.Loop==2)
{
cChar1.StopMoving();
cChar1.SetWalkSpeed(8, 8);
cChar1.FaceLocation(300, 230);
RestoreWalkableArea(2);
cChar1.ChangeView(5);
cChar1.LockView(5);
cChar1.Animate(2, 7, eRepeat, eNoBlock);
}
else if (keycode == 74 && player.View==3 && player.Loop==1)
{
cChar1.StopMoving();
cChar1.SetWalkSpeed(8, 8);
player.FaceLocation(0, 230);
RestoreWalkableArea(2);
cChar1.ChangeView(4);
cChar1.LockView(4);
cChar1.Animate(1, 7, eRepeat, eNoBlock);
}
I'm still working on it and its 99.99% right.
cheers
steptoe
Like I said, you need player.ChangeView(); I meant instead of LockView(). Reading the command's manual entries is underrated ;) The former will permanently change the character's NormalView, not just temporarily lock it to another, disabling the normal view used for walking in the process.
You have again used lots of duplicate code. Then you've used player.FaceLocation which basically changes their Loop at a point where you already know the Loop / which way the player is facing.
if (keycode == eKeyJ && player.View == 3) {
player.StopMoving();
player.SetWalkSpeed(8, 8);
RestoreWalkableArea(2);
if (player.Loop == 2) player.ChangeView(5);
if (player.Loop == 1) player.ChangeView(4);
// player.ChangeView(player.Loop + 3);
}
(I assume that both views contain only frames with the player facing the same direction, right?)
Now, if you want a continuous jetpack animation to play while the player is both walking and standing (since you're using standard walking for the flying part), you might want to put the animation in a second character and have them follow the player using FOLLOW_EXACTLY.
Or you assign an IdleView (player.SetIdleView) with a delay of 0 that'll animate the jetpack while the player is "standing".
Edit: ==
Hi Khris
edit: if (keycode == eKeyJ && player.View == 3) {
Yes, i understand what you are saying.
I'll copy your code and run a copy.
thank you
steptoe