我正在做一个数字艺术课的简单项目。我想做一个简单的小选择你自己的冒险游戏,在那里你看一个剪辑,然后选择几个不同的选项下一步做什么。你的决定会触发一段视频,冒险将持续一段时间,玩家将会逃离鬼屋或被杀。这是我第一次使用HTML5。如果Else按钮在HTML5中被按下?
我需要做以下事情: 1)当按下按钮时,播放某个视频。 2)视频结束后,屏幕顶部的文本块会相应变化,向玩家提供更多信息并比剪辑本身提供的更详细地解释其选项。
现在,我只需要帮助第1步。我似乎无法弄清楚如何让按钮onclick命令正常工作。该程序显示第一个简介视频就好了,但当您点击任何按钮时根本没有反应。我最初希望能够使用某些if-else button.pressed命令,但在HTML5中找不到类似的东西。我知道它无法解决我的代码,因为没有人可以访问我的本地文件,但我会很感激任何建议。谢谢!
这里是我的代码:
Spooks: Choose Your Own Adventurefunction $(id)
{
return document.getElementById(id);
}
//Video Source Changers
function Door()
{
$('movie').src = "file:///C:/Users/Spencer/Videos/Spooks/Trapped.mp4" type="video/mp4">
}
function Wander()
{
$('movie').src = "file:///C:/Users/Spencer/Videos/Spooks/Sesame.mp4" type="video/mp4">
}
function Match()
{
$('movie').src = "file:///C:/Users/Spencer/Videos/Spooks/Sesame.mp4" type="video/mp4">
}
What an awful time to get stranded out in the countryside! It's raining cats and dogs out here. Hungry, freezing, exhausted and desperate, you head to the nearest visible shelter - a decrepit old mansion. Surely southern hospitality will see you safely through the night.
This is creepy. I'll just go back through the front door.
Really weird, but I guess it beats the storm. The owner probably just ran off to get the lights working. I'll wander around a bit, see if I can find him.
It'd be nice to be able to see before I make a decision one way or the other. Let's light a match...
2014-11-24
Spencer