Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: ma2003 on Wed 18/06/2008 20:17:52

Title: Toggling Certain Actions With Keys [SOLVED]
Post by: ma2003 on Wed 18/06/2008 20:17:52
Okay, I'm trying to get my character to toggle into a crawling position via a VIEW.

View 3 (standing view)

(http://img511.imageshack.us/img511/5209/crouchgraphic01zu2.png)

View 8 (crawling view)

(http://img149.imageshack.us/img149/8975/crouchgraphic02tx1.png)

Basically, my character will run around, and I tap SPACE BAR and be able to toggle from standing, to a crawling pose. (ala metal gear solid) or (as another example)... bring out a handgun by tapping and toggling Q (ala Flashback).

I assume a good way to do this is by using Views, and I'm trying to find a way to toggle from view 3 to view 8, and then back to view 3 if I wanted, all by using the same key SPACE BAR (keycode 32).

I believe I have enough knowledge to learn about how this could be done.

I can create a simple crawl mode by doing the obvious:



if (keycode==32) {
cBob.Lockview(8)
}


However, of course, I can't toggle back to the standing pose by pressing the SPACE BAR.

....if anyone could help out. I would appreciate it very very much. Thank you.




Title: Re: Toggling Certain Actions With Keys
Post by: GarageGothic on Wed 18/06/2008 20:43:37
if (keycode==32) {
if (cBob.View == 3) cBob.ChangeView(8);
else if (cBob.View == 8) cBob.ChangeView(3)
}
Title: Re: Toggling Certain Actions With Keys
Post by: ma2003 on Wed 18/06/2008 20:48:26
...and you type it like its easy..

It worked, of course. Thanks alot GarageGothic.