This is My first Jquery Program For Game.
So any Junior who started to learn jquery can see this.This is just a step ahead of function creation and variable definition.
you can do more than me or you implement this much better from this just see what exactly we do in jquery because the basic of the jquery is more important than its development.
<html>
<head>
<style>
body{background:#000;}
#land{position:absolute;margin:100px;}
#hel{position:absolute;margin-top:310px;left:0px;}
#hel2{position:absolute;margin-left:540px;left:0px;margin-top:65px;}
#hel3{position:absolute;margin-left:932px;left:0px;margin-top:370px;}
</style>
<script src="../js/jquery.min.js" type="text/javascript"></script>
<script>
var startthehel=0;
var returnthehell=0;
var returnstarthel=0;
var timer=0;
var secondtimer=0;
var thirdtimer=0;
function runthehel()
{
var imgwidth=932;
var imghalfwidth=932/2; //console.log(imghalfwidth);
var imgheight=279;
var heltop=Number(imgheight/imghalfwidth);
//console.log(heltop);
var startthehel=$("#startthehel").val();
if(startthehel>440)
{
$("#hel").css('display','none');
returnthehell=Number(returnthehell)+10;
secondtimer=Number(returnthehell)-10;
secondtimer=secondtimer*heltop;
$("#hel2").css('left',returnthehell+'px');
$("#hel2").css('top',secondtimer+'px');
$("#hel2").css('display','block');
$("#startthehel").val(returnthehell);
if(returnthehell>430)
{
$("#hel2").css('display','none');
$("#hel3").css('display','block');
returnstarthel=Number(returnstarthel)+10;
$("#hel3").css('left',-returnstarthel+'px');
$("#startthehel").val(returnstarthel);
if(returnstarthel>910)
{ startthehel=0;
returnthehell=0;
returnstarthel=0;
$("#hel3").css('display','none');
$("#hel").css('display','block');
}
}
}
startthehel=Number(startthehel)+10;
timer=Number(startthehel)+10; // timer=timer/1.57;
timer=timer*heltop; //console.log(Math.random(1,3));
if(startthehel<460)
{
$("#hel").css('left',startthehel+'px');
$("#hel").css('top',-timer+'px');
}
//$("#hel").css('display','none');
//$("#hel2").css('display','none');
$("#startthehel").val(startthehel);
}
setInterval(runthehel,50);
</script>
</head>
<body>
<div>
<img id="land" src="img/land.png" />
<img id="hel" src="img/11.png" width="209" />
<img id="hel2" src="img/12.png" width="209" />
<img id="hel3" src="img/13.png" width="150" />
</div>
<input id="startthehel" type="hidden" value="0" />
<input id="activitytype" type="hidden" value="up" />
</body>
</html>
0 comments:
Post a Comment