Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: masterguyperson on Tue 26/02/2019 05:15:42

Title: Timed event and other mechanics noob question
Post by: masterguyperson on Tue 26/02/2019 05:15:42
Hi there. So I am fairly new to using adventure game studio. I have a couple questions as to what is possible to achieve within ags. Let me go into detail about what kind of game I am trying to do, and a certain scene that I would like to see happen in my game - So I am trying to start production on a, perhaps, 90s styled, first person, point and click adventure/maybe horror game. I thought of an idea for a scene that could occur somewhere within the game - the player enters one room where they can see down a hallway, and on either the right or left, up close by the player, a jammed door. The objective for the player in this room is to pry open that door on the side with a crowbar; however, as soon as the player starts trying to pry open the door, I want that to trigger some sort of creature appearing from way down the hallway, and for it to slowly walk towards the player.

So, 2 main things here, when the player is trying to pry open the door, I think I would like it to be something like where the player can see a progression bar, and they have to spam click the mouse on the door to make the progress bar fill up. How would I go about doing this, and how might I adjust how much the player would have to click in order fill the bar - and then how do I make this action actually unlock said door.

2nd thing, I think I have a basic understanding as to how I might pull off the creature bit, but I don't know how to do the coding. As I mentioned, I want a creature to start walking towards the player from down the hallway. For the actual visuals of this happening, I was thinking that I would use a prerendered animation of the creature walking the entire length (I think this is possible inside of ags?) I would make the animation about 30 seconds long, for example, so that way I could set a timer for 30 seconds, and once the timer is up, player is dead. So, firstly, how do I go about coding this timer? When the timer limit is reached, I would have an additional prerendered death animation video that I would like to play, of which I am also clueless as how to code.

Apologies if this is not written very clearly, and many thanks to any and all help you guys give!


Thanks!
Title: Re: Timed event and other mechanics noob question
Post by: Khris on Tue 26/02/2019 07:05:04
All of that is easily possible. Having a 30 second timer is actually the easiest part by far; all you need is SetTimer(1, 30 * GetGameSpeed()); and an IsTimerExpired(1) check in your room's repeatedly_execute event.

Opening the door will also use timing; the basic idea is that each mouse click will increase a variable while passing time will decrease it. That's really it.

The graphical side of this can be achieved with a theora animation playing in the background, below the crowbar gui for instance. And showing a prerendered video is again as simple as calling the PlayVideo() command.
Title: Re: Timed event and other mechanics noob question
Post by: masterguyperson on Tue 26/02/2019 15:36:58
Wow, thank you, that is easy! I'm sure I'll have more questions about other stuff as I go through with making this - but this helps a lot!