css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              body.noisy
div.emblem
  span.icon-information
div.frame
  div.piece.crtoutput
    h2 Text 'o' Matic 6000
    .animated
      .console_stats
        .popupimg
            img#img1.hide(src="http://placehold.it/350x350")
            img#img2(src="http://placehold.it/350x350")
            img#img3.hide(src="http://placehold.it/350x350")
            img#img4.hide(src="http://placehold.it/350x350")
            img#img5.hide(src="http://placehold.it/350x350")
        #stats
          b Stats:
          br
          img(src="http://placehold.it/350x350" width="40px")
          span.label HP: 
          span.stat(data-stat="hp")
          progress.health(value="100", min="0", max="100", data-stat="hp")
          br
          img(src="http://placehold.it/350x350" width="40px")
          span.label Inventory: 
          span.stat(data-stat="inv")
          br
          img(src="http://placehold.it/350x350" width="40px")
          span.label Speed: 
          span.stat(data-stat="spd")
          br
          img(src="http://placehold.it/350x350" width="40px")
          span.label Intelligence: 
          span.stat(data-stat="mgk")
          br
          img(src="http://placehold.it/350x350" width="40px")
          span.label Strength: 
          span.stat(data-stat="str")
          br
          img(src="http://placehold.it/350x350" width="40px")
          span.label Kills: 
          span.stat(data-stat="kc")
          br
        hr
      .console_output
        #gameOutput WHAT IS YOUR ADVENTURER'S NAME?
        br
      div
        hr
        form.user_input#gameForm(name="inputForm", action="action.php")
          input.user-input_type#gameInput(type="text")
          input.user_input(type="submit", value="Submit")
        br
  div.piece.scanlines.noclick
  div.piece.glow.noclick
            
          
!
            
              //colors
$black: #000
$white: #fff
$grey: #666
$green: #008000
$amber: #f90
$red: #f00

//fonts
$font_0: Consolas
$font_1: monaco
$font_2: monospace

html 
    background-color: $black
    font-family: $font_0, $font_1, $font_2
    color: $white
    font-size: 22px
    text-transform: uppercase
    margin: 10px

hr 
    opacity: 0.2
  
img
    width: 50px
    height: 50px
    padding: 5px
    opacity: 0.5

.popupimg
    width: 17vw
    height: 17vw
    position: absolute
    right: 10vw
    bottom: 10hw
    opacity: 0.8
    
    img
        width: 100%
        height: 100%
        
    .hide
        display: none
    
.console_stats 
    font-size: 26px
    
progress
    -webkit-appearance: progress-bar
    appearance: progress-bar
    width: 25vw
    height: 16px
    border: 0
    height: 18px
    border-radius: 8px

.health
    background: $grey
    color: $grey
    transition: background 2s ease-in-out
    transition: color 2s ease-in-out
  
.health-full 
    background: $green
    color: $green
  
.health-half 
    background: $amber
    color: $amber
  
.health-low 
    background: $red
    color: $red

.user_input 
    color: $black
    .user-input_type 
        animation-name: color_change
        animation-duration: 5s
        animation-iteration-count: infinite
        animation-direction: alternate
        color: $white
        border: 0
        width: 100%
        line-height: 2

btn, button, input[type="reset"]
    display: none
 
#gameOutput
    height: 25vh

@keyframes color_change 
    from 
        background-color: rgba(random(255),255,0,0.1)

    to 
        background-color: rgba(random(255),random(255),0,0.1)
      

      
@import url(https://fonts.googleapis.com/css?family=VT323)

*
    box-sizing: border-box

body
    background: #383838
    color: #14fdce
    font-family: 'VT323'
    font-size: 24px
    -webkit-font-smoothing: none
    line-height: 1.2
    
h1
    font-size: 4rem
    margin-bottom: 1rem
    text-transform: uppercase

p
    margin-bottom: 2rem

a
    border-bottom: 0.2rem solid #14fdce
    color: #14fdce
    text-decoration: none
    &:visited
    border-bottom: 0.2rem solid #14fdce
    color: #14fdce
    text-decoration: none
    &:active, &:focus, &:hover
    background-color: #14fdce
    color: #031e11

.piece
    display: block
    height: 100%
    left: 0
    top: 0
    width: 100%

.noclick
    pointer-events: none

.frame
    background-color: transparent
    border-radius: 2rem
    border: 1rem solid
    border-bottom-color: #121212
    border-left-color: #080808
    border-right-color: #080808
    border-top-color: #020202
    box-shadow: inset 0 0 18rem black, inset 0 0 3rem black, 0 0 10rem black
    height: 96%
    position: absolute
    top: 2%
    left: 2%
    width: 96%
    pointer-events: none

.emblem
    display: none
    position: absolute
    left: 50%
    bottom: 0
    font-size: 2rem
    height: 3rem
    width: 3rem
    text-align: center
    color: white
    background: -webkit-linear-gradient(#ffffff, #555555)
    -webkit-background-clip: text
    -webkit-text-fill-color: transparent
    text-shadow: 0 0.1rem 0rem rgba(0, 0, 0, 0.4), 0 0 2rem rgba(0, 0, 0, 0.8)
    -webkit-transform: translate(-50%)
    -ms-transform: translate(-50%)
    transform: translate(-50%)

.crtoutput
    -webkit-animation: crt-output 10ms infinite
    animation: crt-output 10ms infinite
    background-color: #031e11
    overflow: scroll
    position: absolute
    padding: 3rem 2rem
    pointer-events: auto
    text-shadow: 0rem 0.2rem 1rem #0c7b46
    z-index: -1

@-webkit-keyframes crt-output
    0%
    opacity: 0.9

    50%
    opacity: 1


@keyframes crt-output
    0%
    opacity: 0.9

    50%
    opacity: 1


.scanlines
    background: -webkit-linear-gradient(top, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0) 50%, rgba(0, 0, 0, 0.2) 70%, rgba(0, 0, 0, 0.6))
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0) 50%, rgba(0, 0, 0, 0.2) 70%, rgba(0, 0, 0, 0.6))
    background-size: 100% 0.3rem
    border-radius: 2rem
    position: absolute

.glow
    -webkit-animation: crt-glow 60s infinite
    animation: crt-glow 60s infinite
    background: -webkit-radial-gradient(center, circle, #1bd459 0%, rgba(27, 212, 89, 0.88) 58%, rgba(21, 235, 92, 0.57) 80%, rgba(19, 94, 29, 0.27) 93%, rgba(10, 23, 12, 0) 100%)
    background: radial-gradient(circle at center, #1bd459 0%, rgba(27, 212, 89, 0.88) 58%, rgba(21, 235, 92, 0.57) 80%, rgba(19, 94, 29, 0.27) 93%, rgba(10, 23, 12, 0) 100%)
    opacity: 0.15
    pointer-events: none
    position: fixed

@-webkit-keyframes crt-glow
    0%
    opacity: 0.1

    50%
    opacity: 0.2


@keyframes crt-glow
    0%
    opacity: 0.1

    50%
    opacity: 0.2


\::-moz-selection, ::selection
    background-color: #14fdce
    color: #031e11

@font-face
    font-family: 'uuxsl'
    src: url('https://i.icomoon.io/public/188ac2dd2d/VOX/uuxsl.eot')


@font-face
    font-family: 'uuxsl'
    src: url(data:application/x-font-ttf;charset=utf-8;base64,AAEAAAALAIAAAwAwT1MvMg8SA1AAAAC8AAAAYGNtYXAaL8yjAAABHAAAAExnYXNwAAAAEAAAAWgAAAAIZ2x5ZiGj2jMAAAFwAAAA7GhlYWQEpbQaAAACXAAAADZoaGVhB6kDxgAAApQAAAAkaG10eAYAABkAAAK4AAAAFGxvY2EAKACKAAACzAAAAAxtYXhwAA0AMgAAAtgAAAAgbmFtZeGQWB4AAAL4AAABM3Bvc3QAAwAAAAAELAAAACAAAwQAAZAABQAAApkCzAAAAI8CmQLMAAAB6wAzAQkAAAAAAAAAAAAAAAAAAAABEAAAAAAAAAAAAAAAAAAAAABAAADmJgPA/8AAQAPAAEAAAAABAAAAAAAAAAAAAAAgAAAAAAACAAAAAwAAABQAAwABAAAAFAAEADgAAAAKAAgAAgACAAEAIOYm//3//wAAAAAAIOYm//3//wAB/+MZ3gADAAEAAAAAAAAAAAAAAAEAAf//AA8AAQAAAAAAAAAAAAIAADc5AQAAAAABAAAAAAAAAAAAAgAANzkBAAAAAAEAAAAAAAAAAAACAAA3OQEAAAAABwAZ/8YD5wO1AAUADQAVABsAIQAnAC8AABMVFzcnNQMFERcnNzU3ARElBxcVFwcvARUHFzcDJwcVNxcHFzc1JwcBBycHJxUFJeFVb1UZ/uJwAslVAkL+4m5VygJYcFVvVs1TU1NTplNTU1MBclXKylUBHwEfAbdnMUExZwG9pf61QWh04zH+UQFLpUEx4nVoNEFoMUExAcAwMHwxMNAxMWkvMP67MXV1MXympwAAAAABAAAAAQAAwDym7F8PPPUACwQAAAAAANDPt9EAAAAA0M+30QAA/8YD5wO1AAAACAACAAAAAAAAAAEAAAPA/8AAAAQAAAAAAAPnAAEAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAgAAAAQAABkAAAAAAAoAFAAeAHYAAQAAAAUAMAAHAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAA4ArgABAAAAAAABAAoAAAABAAAAAAACAA4AOQABAAAAAAADAAoAIAABAAAAAAAEAAoARwABAAAAAAAFABYACgABAAAAAAAGAAUAKgABAAAAAAAKADQAUQADAAEECQABAAoAAAADAAEECQACAA4AOQADAAEECQADAAoAIAADAAEECQAEAAoARwADAAEECQAFABYACgADAAEECQAGAAoALwADAAEECQAKADQAUQB1AHUAeABzAGwAVgBlAHIAcwBpAG8AbgAgADEALgAwAHUAdQB4AHMAbHV1eHNsAHUAdQB4AHMAbABSAGUAZwB1AGwAYQByAHUAdQB4AHMAbABGAG8AbgB0ACAAZwBlAG4AZQByAGEAdABlAGQAIABiAHkAIABJAGMAbwBNAG8AbwBuAC4AAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=) format("truetype"), url(data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAASYAAsAAAAABEwAAQAAAAAAAAAAAA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AQAAAAAAAQAKAAAAAQAAAAAAAgAOADkAAQAAAAAAAwAKACAAAQAAAAAABAAKAEcAAQAAAAAABQAWAAoAAQAAAAAABgAFACoAAQAAAAAACgA0AFEAAwABBAkAAQAKAAAAAwABBAkAAgAOADkAAwABBAkAAwAKACAAAwABBAkABAAKAEcAAwABBAkABQAWAAoAAwABBAkABgAKAC8AAwABBAkACgA0AFEAdQB1AHgAcwBsAFYAZQByAHMAaQBvAG4AIAAxAC4AMAB1AHUAeABzAGx1dXhzbAB1AHUAeABzAGwAUgBlAGcAdQBsAGEAcgB1AHUAeABzAGwARgBvAG4AdAAgAGcAZQBuAGUAcgBhAHQAZQBkACAAYgB5ACAASQBjAG8ATQBvAG8AbgAuAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA) format("woff")
    font-weight: normal
    font-style: normal


\::-moz-selection [class^="icon-"], [class*=" icon-"]
    font-family: 'uuxsl'
    speak: none
    font-style: normal
    font-weight: normal
    font-variant: normal
    text-transform: none
    line-height: 1
    -webkit-font-smoothing: antialiased
    -moz-osx-font-smoothing: grayscale

\::selection [class^="icon-"], [class*=" icon-"]
    font-family: 'uuxsl'
    speak: none
    font-style: normal
    font-weight: normal
    font-variant: normal
    text-transform: none
    line-height: 1
    -webkit-font-smoothing: antialiased
    -moz-osx-font-smoothing: grayscale

\::-moz-selection .icon-information:before, ::selection .icon-information:before
    content: "\e626"

\::-moz-selection .noisy, ::selection .noisy
    background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAMAAABHPGVmAAAAbFBMVEUAAAAJCQkSEhIWFhYfHx8oKCgsLCw1NTU+Pj5CQkJLS0tUVFRYWFhhYWFqampubm53d3eAgICEhISNjY2RkZGampqjo6Onp6ewsLC5ubm9vb3GxsbPz8/T09Pc3Nzl5eXp6eny8vL7+/v///8bU22NAAAAJHRSTlMGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgav3eMaAAAZ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JN+Q6X4NgAAAABJRU5ErkJggg==)
            
          
!
            
              var TextAdventure = function() {

    // PRIVATE VARIABLES

    // Initialize Starting Stat List \\
    var stats = {
            spd: 3,
            mgk: 3,
            str: 3,
            hp: 100,
            inv: [{
                name: "sword",
                type: "atk",
                damage: 5
            }, {
                name: "helmet",
                type: "def",
                armour: 3
            }],
            kc: 0,
            dmg: 10
        },

        // Initialize Other Variables \\
        userInput,
        currentChapter = 0,
        user = {},

        // PRIVATE FUNCTIONS

        // Refresh the stats \\
        update = function(data) {

            console.log(data);

            $.each(data, function(key, val) {
                if (key == 'name') {
                    user.name = val;
                    console.log('Name is: ' + val);
                } else if (stats.hasOwnProperty(key)) {
                    setStat(key, val);
                    showStat(key);
                    console.log('key: ' + key + ' & val: ' + val);
                }
            });
        },

        // Tool Functions \\

        clearConsole = function() {
            $('#output').html('');
        },

        gameOver = function() {
            alert('GAME OVER');
        },

        inventoryToStringvar = function(inv) {
            var outputString = '';
            $.each(inv, function(key, val) {
                outputString += key + ': ' + val + ', ';
            });

            return outputString;
        },

        incrementStat = function(stat, amount) {

            // Update data
            stats[stat] += amount;

            // Update DOM
            if (stat == 'hp') {

                var $health = $('#hitpoints');
                $health.val(hp);
                // NOTE: This feature is currently broken
                if (hp <= 0) {
                    hp = 0;
                    console.log("change to empty");
                    $health.removeClass("health-half health-full").addClass("health-low");
                    gameOver();
                } else if (hp <= 50) {
                    console.log("change to half");
                    $health.removeClass("health-low health-full").addClass("health-half");
                } else if (hp >= 100) {
                    hp = 100;
                    console.log("change to full");
                    $health.removeClass("health-half health-low").addClass("health-full");
                } else {
                    console.log("change to full");
                    $health.removeClass("health-half health-low").addClass("health-full");
                }
            }

            $('.stat[data-stat="' + stat + '"]').text(stats[stat]);
        },
        
        incrementStats = function(amount) {
            incrementStat("spd", amount),
            incrementStat("mgk", amount),
            incrementStat("str", amount);
        },

        getStat = function(stat) {
            return stats[stat];
        },

        setStat = function(stat, newValue) {
            stats[stat] = newValue;
            return getStat(stat);
        },

        showStat = function(stat) {

            var value = getStat(stat);

            $('[data-stat="' + stat + '"]').each(function() {
                var $el = $(this);

                if ($el.prop("tagName") == 'PROGRESS') {
                    $el.animate({
                        value: value
                    }, 1000);
                } else {
                    $el.text(value);
                }
            });
        },

        showStats = function() {

            $.each(stats, function(key, val) {
                showStat(key);
            });
        },

        setChapter = function(chapter) {
            currentChapter = chapter;
        },
    
        showSuccessMessage = function() {
            alert("Level up!");
        };

    // PUBLIC FUNCTIONS
    return {

        init: function() {
            showStats();
        },

        levelUp: function() {
            incrementStats(10);
            showSuccessMessage();
        },

        getChapter: function() {
            return currentChapter;
        },

        // Run Game \\
        update: function(data) {

            update(data);
            var newChapter = currentChapter + 1;
            setChapter(newChapter);
        }
    }
}();

$(function() {

    TextAdventure.init();

    var $gameForm = $('#gameForm'),
        $gameInput = $('#gameInput'),
        $output = $('#gameOutput'),
        $img1 = $('#img1'),
        $img2 = $('#img2'),
        $img3 = $('#img3'),
        $img4 = $('#img4'),
        $img5 = $('#img5');

    // EVENT HANDLERS
    $gameForm.on('submit', function() {

        var chapter = TextAdventure.getChapter(),
            data, // null
            userInput = $gameInput.val();

        if (chapter == 0) {
            TextAdventure.levelUp();
            $output.html('Welcome, ' + userInput + '. Input a number to changee all your stats...');
            $img2.addClass("hide");
            $img3.removeClass("hide");

            data = {
                name: userInput
            };
        } else if (chapter == 1) {
            $output.html('Input a number to change your kill count...');
            $img3.addClass("hide");
            $img4.removeClass("hide");

            data = {
                hp: userInput,
                spd: userInput,
                mgk: userInput,
                str: userInput
            };
        } else if (chapter == 2) {
            $output.html('Input a  number to modify your health...');
            $img4.addClass("hide");
            $img5.removeClass("hide");

            data = {
                kc: userInput
            };
        } else if (chapter == 3) {
            $output.html('STOP! Do not submit anything!');
            $img5.addClass("hide");
            $img1.removeClass("hide");

            data = {
                hp: userInput
            };
        } else {
            $output.html('Game over!');
            $img1.addClass("hide");
            $img2.removeClass("hide");

            data = {
                hp: 0
            };
        }
        
        TextAdventure.update(data);
    });
});
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console