Over the last few days I have been working on a text based adventure game written in JavaScript. I learnt how to do this on the codeacademy website:
This is what the program looks like when running my adventure game:
If you follow the above link it should take you straight to the part of the tutorial where you build your own game. You may need to select lesson 6/6 from the drop-down arrow on the left hand side, inside the white side panel.
If you want to you can follow this linkΒ to copy and paste my code from there into the simulator found at the previous link:
https://drive.google.com/file/d/0B6y9ITteBcqLVV9fbFZlTUg5T28/view?usp=sharing
Hopefully you will enjoy playing this text based rpg style game. Its the longest piece of code I’v written so far but the story-lines are not even 2 minutes long.
You will notice this post is entitled ‘JavaScript- Text Based Adventure Game 1’. This is because I have been trying to insert this code file into a html file for it run on the browser and I cannot figure it out! I think my coding is wrong somewhere but I do not know anything about HTML so I’m not too disappointed. Once I crack this enigma (and maybe one of you will know how I can do it) then I will post a second post linking straight to the html site where the game can be played!
Any thoughts on how to make this better, more fun, or just if you can help me out with inserting it into a html file that works in the browser would be amazing and greatly appreciated! π π have fun π π
Hey! Congrats, looking forward to playing it.
LikeLiked by 1 person
thanks let me know what you think π have fun π
LikeLike
Hi!
I run the script in Firefox 38.0.5’s console. In case you wanna see what I got:
KNIGHT
CHAPEL
NO
——————————————–
>undefined
“The priest names you as a coward. You have not acted like a knight. Your adventure is over”
——————————————–
KNIGHT
CHAPEL
YES
NO
———————————–
>undefined
“The priest names you as a coward and you are disgraced”
———————————–
KNIGHT
CHAPEL
YES
YES
3 (not have a torch)
NO
———————————–
>undefined
———————————–
KNIGHT
CHAPEL
YES
YES
3 (not have a torch)
YES
SWORD
3
———————————–
>undefined
———————————–
LikeLiked by 1 person
Hi thank you so much I’m glad you tried it out, you got more results than me lol i get a blank screen in IE, Chrome and with Firefox all I can see is the text lmao π also the first results are correct the second are errors in my code π π darn coding π π
LikeLiked by 1 person
M’Lady, as you asked, here is your creation, for the enjoyment of the commoners:
https://jsfiddle.net/b83y9nye
(You can use that URL in a blog. I learned about jsfiddle on “Javascript for Kids”
http://www.nostarch.com/javascriptforkids. It’s not easy to run a javascript in wordpress.com)
LikeLiked by 2 people
Wow thank you so much π π I don’t have time to edit my code at the moment but I will and will post an update when it is fully complete π Thanks again for doing that π π
LikeLike
[…] So last night I had some time to look at the old code from part 1 https://ashbotandsparki.wordpress.com/2015/06/14/javascript-text-based-adventure-game-1/ […]
LikeLike
Wonderful, I was able to give it a go using @franzcalvo’s jsfiddle version. Well done!
In case you might be interested, http://codepen.io/ is another similar JavaScript code-sharing site. It works much the same as jsfiddle but looks a lot like Codecademy.
LikeLiked by 1 person
awesome thank you π π
LikeLiked by 1 person