forked from targetkiller/climbUp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
first commit
- Loading branch information
0 parents
commit a7dda9f
Showing
5 changed files
with
368 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto | ||
|
||
# Custom for Visual Studio | ||
*.cs diff=csharp | ||
*.sln merge=union | ||
*.csproj merge=union | ||
*.vbproj merge=union | ||
*.fsproj merge=union | ||
*.dbproj merge=union | ||
|
||
# Standard to msysgit | ||
*.doc diff=astextplain | ||
*.DOC diff=astextplain | ||
*.docx diff=astextplain | ||
*.DOCX diff=astextplain | ||
*.dot diff=astextplain | ||
*.DOT diff=astextplain | ||
*.pdf diff=astextplain | ||
*.PDF diff=astextplain | ||
*.rtf diff=astextplain | ||
*.RTF diff=astextplain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,215 @@ | ||
################# | ||
## Eclipse | ||
################# | ||
|
||
*.pydevproject | ||
.project | ||
.metadata | ||
bin/ | ||
tmp/ | ||
*.tmp | ||
*.bak | ||
*.swp | ||
*~.nib | ||
local.properties | ||
.classpath | ||
.settings/ | ||
.loadpath | ||
|
||
# External tool builders | ||
.externalToolBuilders/ | ||
|
||
# Locally stored "Eclipse launch configurations" | ||
*.launch | ||
|
||
# CDT-specific | ||
.cproject | ||
|
||
# PDT-specific | ||
.buildpath | ||
|
||
|
||
################# | ||
## Visual Studio | ||
################# | ||
|
||
## Ignore Visual Studio temporary files, build results, and | ||
## files generated by popular Visual Studio add-ons. | ||
|
||
# User-specific files | ||
*.suo | ||
*.user | ||
*.sln.docstates | ||
|
||
# Build results | ||
|
||
[Dd]ebug/ | ||
[Rr]elease/ | ||
x64/ | ||
build/ | ||
[Bb]in/ | ||
[Oo]bj/ | ||
|
||
# MSTest test Results | ||
[Tt]est[Rr]esult*/ | ||
[Bb]uild[Ll]og.* | ||
|
||
*_i.c | ||
*_p.c | ||
*.ilk | ||
*.meta | ||
*.obj | ||
*.pch | ||
*.pdb | ||
*.pgc | ||
*.pgd | ||
*.rsp | ||
*.sbr | ||
*.tlb | ||
*.tli | ||
*.tlh | ||
*.tmp | ||
*.tmp_proj | ||
*.log | ||
*.vspscc | ||
*.vssscc | ||
.builds | ||
*.pidb | ||
*.log | ||
*.scc | ||
|
||
# Visual C++ cache files | ||
ipch/ | ||
*.aps | ||
*.ncb | ||
*.opensdf | ||
*.sdf | ||
*.cachefile | ||
|
||
# Visual Studio profiler | ||
*.psess | ||
*.vsp | ||
*.vspx | ||
|
||
# Guidance Automation Toolkit | ||
*.gpState | ||
|
||
# ReSharper is a .NET coding add-in | ||
_ReSharper*/ | ||
*.[Rr]e[Ss]harper | ||
|
||
# TeamCity is a build add-in | ||
_TeamCity* | ||
|
||
# DotCover is a Code Coverage Tool | ||
*.dotCover | ||
|
||
# NCrunch | ||
*.ncrunch* | ||
.*crunch*.local.xml | ||
|
||
# Installshield output folder | ||
[Ee]xpress/ | ||
|
||
# DocProject is a documentation generator add-in | ||
DocProject/buildhelp/ | ||
DocProject/Help/*.HxT | ||
DocProject/Help/*.HxC | ||
DocProject/Help/*.hhc | ||
DocProject/Help/*.hhk | ||
DocProject/Help/*.hhp | ||
DocProject/Help/Html2 | ||
DocProject/Help/html | ||
|
||
# Click-Once directory | ||
publish/ | ||
|
||
# Publish Web Output | ||
*.Publish.xml | ||
*.pubxml | ||
|
||
# NuGet Packages Directory | ||
## TODO: If you have NuGet Package Restore enabled, uncomment the next line | ||
#packages/ | ||
|
||
# Windows Azure Build Output | ||
csx | ||
*.build.csdef | ||
|
||
# Windows Store app package directory | ||
AppPackages/ | ||
|
||
# Others | ||
sql/ | ||
*.Cache | ||
ClientBin/ | ||
[Ss]tyle[Cc]op.* | ||
~$* | ||
*~ | ||
*.dbmdl | ||
*.[Pp]ublish.xml | ||
*.pfx | ||
*.publishsettings | ||
|
||
# RIA/Silverlight projects | ||
Generated_Code/ | ||
|
||
# Backup & report files from converting an old project file to a newer | ||
# Visual Studio version. Backup files are not needed, because we have git ;-) | ||
_UpgradeReport_Files/ | ||
Backup*/ | ||
UpgradeLog*.XML | ||
UpgradeLog*.htm | ||
|
||
# SQL Server files | ||
App_Data/*.mdf | ||
App_Data/*.ldf | ||
|
||
############# | ||
## Windows detritus | ||
############# | ||
|
||
# Windows image file caches | ||
Thumbs.db | ||
ehthumbs.db | ||
|
||
# Folder config file | ||
Desktop.ini | ||
|
||
# Recycle Bin used on file shares | ||
$RECYCLE.BIN/ | ||
|
||
# Mac crap | ||
.DS_Store | ||
|
||
|
||
############# | ||
## Python | ||
############# | ||
|
||
*.py[co] | ||
|
||
# Packages | ||
*.egg | ||
*.egg-info | ||
dist/ | ||
build/ | ||
eggs/ | ||
parts/ | ||
var/ | ||
sdist/ | ||
develop-eggs/ | ||
.installed.cfg | ||
|
||
# Installer logs | ||
pip-log.txt | ||
|
||
# Unit test / coverage reports | ||
.coverage | ||
.tox | ||
|
||
#Translations | ||
*.mo | ||
|
||
#Mr Developer | ||
.mr.developer.cfg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
/* | ||
* @author:tqtan; | ||
* @date:14/5/12; | ||
* @content:游戏逻辑代码; | ||
*/ | ||
window.RAF = | ||
(function () { | ||
return window.requestAnimationFrame || | ||
window.webkitRequestAnimationFrame || | ||
window.mozRequestAnimationFrame || | ||
window.oRequestAnimationFrame || | ||
window.msRequestAnimationFrame || | ||
|
||
function (callback, element) { | ||
var start, | ||
finish; | ||
|
||
window.setTimeout( function () { | ||
start = +new Date(); | ||
callback(start); | ||
finish = +new Date(); | ||
|
||
self.timeout = 1000 / 60 - (finish - start); | ||
|
||
}, self.timeout); | ||
}; | ||
} | ||
) | ||
(); | ||
|
||
var ClimbUp = function(){ | ||
// init --------------------------- | ||
this.canvas = document.getElementById('game'), | ||
this.ctx = this.canvas.getContext('2d'), | ||
this.Bwidth = this.canvas.clientWidth, | ||
this.Bheight = this.canvas.clientHeight, | ||
this.canvas.width = this.Bwidth, | ||
this.canvas.height = this.Bheight, | ||
|
||
// setting ------------------------ | ||
this.treeWidth = 40, | ||
this.treeHeight = this.Bheight, | ||
this.treeColor = "#770000", | ||
|
||
this.branchWidth = 150, | ||
this.branchHeight = 30, | ||
this.branchColor = "#770000", | ||
this.branchs = [], | ||
|
||
// control ------------------------ | ||
|
||
this.branchsInit = { | ||
execute:function(){ | ||
for(var i = 0; i < 5; i++){ | ||
this.branchInit(); | ||
} | ||
}, | ||
branchInit:function(){ | ||
var _x = Math.floor(Math.random()*2)==1? | ||
((climbUp.Bwidth-climbUp.treeWidth)/2-climbUp.branchWidth+1): | ||
((climbUp.Bwidth+climbUp.treeWidth)/2-1); | ||
var _y = Math.floor(Math.random()*climbUp.Bheight); | ||
climbUp.branchs.push({x:_x,y:_y}); | ||
} | ||
} | ||
}; | ||
|
||
// prototype extend | ||
ClimbUp.prototype = { | ||
start:function(){ | ||
// init | ||
this.ctx.clearRect(0,0,this.Bwidth,this.Bheight); | ||
this.branchs=[]; | ||
|
||
this.branchsInit.execute(); | ||
this.drawAll(); | ||
RAF(function(){climbUp.start();}); | ||
}, | ||
drawAll:function(){ | ||
this.drawTree(); | ||
this.drawBranch(); | ||
}, | ||
drawTree:function(){ | ||
this.ctx.save(); | ||
this.ctx.fillStyle = this.treeColor; | ||
this.ctx.strokeStyle = this.treeColor; | ||
this.ctx.fillRect((this.Bwidth-this.treeWidth)/2,0,this.treeWidth,this.treeHeight); | ||
this.ctx.restore(); | ||
}, | ||
drawBranch:function(){ | ||
this.ctx.save(); | ||
this.ctx.fillStyle = this.branchColor; | ||
this.ctx.strokeStyle = this.branchColor; | ||
for(var i = 0; i < this.branchs.length; i++){ | ||
this.ctx.fillRect(this.branchs[i].x,this.branchs[i].y,this.branchWidth,this.branchHeight); | ||
} | ||
this.ctx.restore(); | ||
} | ||
} | ||
|
||
var climbUp = new ClimbUp(); | ||
RAF(function(){climbUp.start();}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<!doctype html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"> | ||
<title>向上爬-html5游戏</title> | ||
<link rel="stylesheet" href="style.css"> | ||
</head> | ||
<body> | ||
<header id="header"> | ||
<p>向上爬</p> | ||
</header> | ||
<canvas id="game" width="500px" height="500px"></canvas> | ||
<script src="game.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
* @author:tqtan; | ||
* @date:14/5/12; | ||
* @content:游戏样式表; | ||
*/ | ||
|
||
body{margin:0;background-color: #000;} | ||
*{font-family: Helvitica,Microsoft yahei,tohama,arial;-webkit-font-smoothing:antialiased;} | ||
|
||
#header{position: fixed;top: 0;width: 100%;height: 60px;background-color: rgba(255,255,255,0.7);z-index: 2;transition:all .2s ease-out;} | ||
#header:hover{background-color: rgba(255,255,255,1.0);} | ||
#header p{text-align: center;color: #770000;line-height: 60px;margin: 0;font-size: 22px;} | ||
|
||
#game{display: block;position: absolute;width: 100%;height: 100%;} |