Create a survival horror game in Flash – AS3 version

I receive almost daily requests to port the old AS2 survival horror game in AS3, so here it is.

Since it was an easy conversion, I decided to add two features:

* Adjustable torch power using keys 1 and 2

* A flicker variable to set torch flickering rate (0-100)

So we can also have an upgradable torch…

To know the whole concept behind this, I recommend you to read step 1.

Here it is the AS3 example:

And this is the result:

Move the player with arrow keys, aim the torch with the mouse and increase/decrease its power with 1 and 2.

Download the source code.

  • I made a great game using this tecnique. http://www.games121.com/2009/06/ultimate-assassin-2.html

  • Alessio

    Grazie mille!

    Quando riuscirò a farlo da solo probabilmente esisterà l’ActionScript 8.0

  • ps2ita

    Grazie!
    Spero che si potrà creare un bel gioco!
    Secondo me però devi aggiungere anche qualche potenziamento (vita ecc.) e armi per uccidere i nemici

  • antoan

    light.graphics.beginFill(0xffffff, 100);

    I think that should be light.graphics.beginFill(0xffffff, 1) (the alpha value should be 1, not 100)

  • Pingback: Ganalot! » Blog Archive » Resident Evil 5 (PC) Review()

  • Pingback: Create a Flash racing game tutorial – Artificial intelligence - Emanuele Feronato()

  • DannyDaNinja

    ThankyouThankyouThankyouThankyouThankyouThankyouThankyouThankyou

  • Pingback: Call of Cthulhu survival horror game prototype()

  • Ryan

    i noticed a glitch in this: if you continue to decrease the power of the flashlight, it eventually will shine behind the player. How do you fix this?

    • Hi, I believe modifying the switch case (case 50) to this should help

      case 50 :
      If(torch_power>0){torch_power–;}
      break;

  • Timothy

    He i can really use this for a school project but how do i get this to work? i got flashdevelop and flash builder installed but i cant seem to open the .fla file. what do i need to open it so i can see all of the source code?

    thanks in advance.

  • Nick

    is it possible to convert this into code that would work on an individual frame?

  • Nick

    sorry for double post, where is ray_angle defined?

    • Hi…I think I saw it in the for-loop where each ray is being drawn (if this is what you’re looking for)

      ray_angle = to_radians((to_degrees(angle)-90-(torch_angle/2)+i));

  • Could you explain what to do if the walls aren’t completely black? I want them to be visible only when you look at them.

  • Kyle O’Donnell

    Is it possible to have the same kind of movement/collision detection system when the level is moving around a character instead of character moving around a level?

  • John

    Have you considered using the Point.polar(distance, angle) and drawing a line to that point? A lot less trigo required.

  • Thomas

    Can I please have a tutorial on enemies and weapons?

  • I held down 2 for a long time and the light came out of its butt?!

  • Chris

    Can you please show us how to give the light a gradient? So it fades out, rather than ends on a hard edge. THANKS!

  • keee99

    Do the next part on enemies and power ups!

  • CjTheDragonWolf

    Game is good, but did what happened to that second part? plus you may want to put a limit on how far backthe light can go. hold 2 long and you get light shining out your ass somehow.

  • Eri

    where do i put this text , sorry im begineer!

  • Pingback: A quick HTML5 survival horror prototype made with Phaser | Emanuele Feronato()