• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

QTE : Fail System

Explorer ,
Mar 05, 2019 Mar 05, 2019

Copy link to clipboard

Copied

Hello masters!

How do you add a fail system to the game?  The breakdown code can only fail if the timer runs out meaning you can button mash the keys without a care in the world. A straightforward fraud.

My intention is if the player presses any key besides E for example, it will instantly go to the fail scene. I am very sure it can be done. Because it's technically still scene navigation.

import flash.events.KeyboardEvent;

import flash.ui.Keyboard;

function keyDownHandler(e:KeyboardEvent):void

{

     if (currentScene.name == "Scene 1")

     {

          if (e.keyCode == Keyboard.E)

               gotoAndPlay(1, "Scene 2 transfer");

     }

}   

stage.focus = stage; 

 

if (!stage.hasEventListener(KeyboardEvent.KEY_DOWN)) 

     stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler); 

HELP3.jpg

I hope you'll understand! Thanks!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

TOPICS
ActionScript

Views

315

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 05, 2019 Mar 05, 2019

Copy link to clipboard

Copied

Hi again.

I'm not quite sure of exactly what you need.

Do you want to send the player to another scene if he/she presses any key other than E?

If that's the case, you can use an inequality operator like this:

if (e.keyCode != Keyboard.E)

    gotoAndPlay(1, "Scene 2 transfer");

Please let us know.

Regards,

JC

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 06, 2019 Mar 06, 2019

Copy link to clipboard

Copied

Alright, let me refine what I mean.  So my intention is if I press the correct key, the scene progresses. If I press the wrong key, it goes to a different scene. I call it the "Fail scene."

Pressed the right key, it goes to scene 2.

Pressed any other key, it goes to scene 3 (Fail scene)

Both have to exist in the same line of code.

If this is possible to do, you can write it without worrying about the green quotation mark things. I can edit those.

something like :

}       

                 }

                   else if  (e.keyCode == Keyboard.FAIL) 

                                   gotoAndPlay(1, "scene 3");  

However, write in your terms which suits you.

Let's make it easier to understand even if you know what my intention is by now. I'll pretend the key pressing interactive game started from scratch.

Let's say I created three scenes: the starting scene (in which I choose to use E), the success scene (in which I press the right key) and the fail scene (in which I press the wrong key). How can you make the game work?

Note: I do not mean to underestimate your level of knowledge. Just want to make things easy for you considering you are quite possibly working hard.

PICTURES:

HELP3.jpg

Thanks

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 06, 2019 Mar 06, 2019

Copy link to clipboard

Copied

LATEST

Hi.

Hmmm... Tell me if this is what you want:

if (e.keyCode == Keyboard.E)

    gotoAndPlay(1, "Sucess Scene");

else

    gotoAndPlay(1, "Fail Scene");

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines