Difference between revisions of "An Event in Time"

From The Official Visionaire Studio: Adventure Game Engine Wiki
m
Line 7: Line 7:
  
 
The simplest method for controlling time is to use the '''pause''' action part. The pause action part will prevent any action parts created after it from executing until the pause has finished.
 
The simplest method for controlling time is to use the '''pause''' action part. The pause action part will prevent any action parts created after it from executing until the pause has finished.
 
+
<hr>
 
{| class="ts"
 
{| class="ts"
 
|-
 
|-
 
| ''Quick note: The pause action part allows you to specify the time in milliseconds, seconds, or minutes; however I highly recommend that you use milliseconds because it allows you to input precise time values.''
 
| ''Quick note: The pause action part allows you to specify the time in milliseconds, seconds, or minutes; however I highly recommend that you use milliseconds because it allows you to input precise time values.''
 
|}
 
|}
 
+
<hr>
 
Anyway, here's an example of the pause action part being used with some other action parts...
 
Anyway, here's an example of the pause action part being used with some other action parts...
 
+
<hr>
 
  if condition "cond_example" is true
 
  if condition "cond_example" is true
 
  pause for 500 milliseconds
 
  pause for 500 milliseconds
Line 28: Line 28:
  
 
Anyway, let's just assume you have created a value somewhere inside of the Visionaire Studio editor & have called it "v_time". Right, let's see an example of what a dynamic pause would look like inside of an action block...
 
Anyway, let's just assume you have created a value somewhere inside of the Visionaire Studio editor & have called it "v_time". Right, let's see an example of what a dynamic pause would look like inside of an action block...
 
+
<hr>
 
  set random value "v_time" between 100 and 3000
 
  set random value "v_time" between 100 and 3000
 
  pause for "v_time" milliseconds
 
  pause for "v_time" milliseconds
Line 37: Line 37:
  
 
Did you know that you can edit animation frames via [[File:Anim_editframev2.png|16px|link=]] & assign sounds & actions to each individual animation frame? This is actually a really great method for precision timing based events as they are tied to animation frames instead of the frames per second (fps) that your game is running on each players device. It's much more accurate than using the pause action part.
 
Did you know that you can edit animation frames via [[File:Anim_editframev2.png|16px|link=]] & assign sounds & actions to each individual animation frame? This is actually a really great method for precision timing based events as they are tied to animation frames instead of the frames per second (fps) that your game is running on each players device. It's much more accurate than using the pause action part.
 
+
<hr>
 
[[File:Vs_anim_frame_actions.png|800px]]
 
[[File:Vs_anim_frame_actions.png|800px]]
  
Line 45: Line 45:
 
The '''jump to action part''' action part is one of the methods that you can use for creating loops inside of the Visionaire Studio editor without having to resort to scripting. There are 2 ways that you can use the jump to x action part, which are...
 
The '''jump to action part''' action part is one of the methods that you can use for creating loops inside of the Visionaire Studio editor without having to resort to scripting. There are 2 ways that you can use the jump to x action part, which are...
 
<hr>
 
<hr>
=== absolute ===
+
=== Absolute ===
  
 
This is the option you would probably be using most of the time & it's the simplest method as you simply tell the engine to jump to x action part inside of the current action block. For example #1 would be the first action part in the list aka the top of the list.
 
This is the option you would probably be using most of the time & it's the simplest method as you simply tell the engine to jump to x action part inside of the current action block. For example #1 would be the first action part in the list aka the top of the list.
  
 
Here's a quick example of what the action block might look like...
 
Here's a quick example of what the action block might look like...
 
+
<hr>
 
  if condition "cond_example" is false (''this is where the jump to action part will jump back to'')
 
  if condition "cond_example" is false (''this is where the jump to action part will jump back to'')
 
  pause for 500 milliseconds
 
  pause for 500 milliseconds
Line 58: Line 58:
  
 
<hr>
 
<hr>
=== relative ===
+
=== Relative ===
 
{{toc}}
 
{{toc}}

Revision as of 17:47, 1 August 2022

On this page you will find a bunch of tips & tricks related to events, loops, & timing methods that you can use to control exactly when specific events &/or state changes (via values/conditions) should occur in your game projects.

Anyway, let's crack on...


Pause (static)

The simplest method for controlling time is to use the pause action part. The pause action part will prevent any action parts created after it from executing until the pause has finished.


Quick note: The pause action part allows you to specify the time in milliseconds, seconds, or minutes; however I highly recommend that you use milliseconds because it allows you to input precise time values.

Anyway, here's an example of the pause action part being used with some other action parts...


if condition "cond_example" is true
pause for 500 milliseconds
change condition "cond_example" to false
end if


Pause (dynamic)

The same action part above can also be used to create dynamic pauses, which can be really useful for making your game projects feel more alive & less like a broken record stuck in a never-ending loop.

To setup dynamic pauses you will need to create a value that you can link to the pause action part. The integer number belonging to values can be modified at any time via action parts or script; however we will only be covering action parts for now to keep things as simple as possible.

Anyway, let's just assume you have created a value somewhere inside of the Visionaire Studio editor & have called it "v_time". Right, let's see an example of what a dynamic pause would look like inside of an action block...


set random value "v_time" between 100 and 3000
pause for "v_time" milliseconds
-- additional action parts go here


Animation Frame Events

Did you know that you can edit animation frames via Anim editframev2.png & assign sounds & actions to each individual animation frame? This is actually a really great method for precision timing based events as they are tied to animation frames instead of the frames per second (fps) that your game is running on each players device. It's much more accurate than using the pause action part.


Vs anim frame actions.png


Jump to Action Part

The jump to action part action part is one of the methods that you can use for creating loops inside of the Visionaire Studio editor without having to resort to scripting. There are 2 ways that you can use the jump to x action part, which are...


Absolute

This is the option you would probably be using most of the time & it's the simplest method as you simply tell the engine to jump to x action part inside of the current action block. For example #1 would be the first action part in the list aka the top of the list.

Here's a quick example of what the action block might look like...


if condition "cond_example" is false (this is where the jump to action part will jump back to)
pause for 500 milliseconds
jump to action part #1
end if
display text "hello world" (if condition "cond_example" is true then this would be executed instead)

Relative