Skip to content

Commit aefa1a1

Browse files
unknownunknown
unknown
authored and
unknown
committed
First commit
0 parents  commit aefa1a1

File tree

8 files changed

+387
-0
lines changed

8 files changed

+387
-0
lines changed

.gitignore

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#Ignore compiled javascript #
2+
######################
3+
./ts/*.js
4+
5+
# Logs and databases #
6+
######################
7+
*.log
8+
*.sql
9+
*.sqlite
10+
11+
# OS generated files #
12+
######################
13+
.DS_Store
14+
.DS_Store?
15+
._*
16+
.Spotlight-V100
17+
.Trashes
18+
Icon?
19+
ehthumbs.db
20+
Thumbs.db

build.bat

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
tsc ./ts/AppStart.ts -out ./ts/gamestart.js
2+
start ./html/GameStart.html

clean.bat

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rm ./ts/gamestart.js

html/GameStart.html

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<html>
2+
<head>
3+
4+
</head>
5+
<body>
6+
<script type="text/javascript" src="../ts/gamestart.js"></script>
7+
</body>
8+
9+
</html>

makefile

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
all: ./ts/AppStart.ts ./ts/Game.ts
2+
tsc ./ts/AppStart.ts -out ./ts/gamestart.js
3+
start ./html/GameStart.html

ts/Algebra.ts

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
class Point2D {
2+
3+
constructor (public x: number = 0, public y: number =0){
4+
5+
}
6+
7+
distance(p :Point2D){
8+
return Math.sqrt(Math.pow(this.x-p.x,2) + Math.pow(this.y -p.y,2));
9+
}
10+
11+
toString(){
12+
return "(" + this.x + "," + this.y + ")";
13+
}
14+
}
15+
16+
class Point3D extends Point2D {
17+
constructor (x :number = 0, y:number =0 , public z:number = 0){
18+
super(x,y);
19+
}
20+
21+
distance(p : Point3D){
22+
return Math.sqrt(Math.pow(this.x-p.x,2)+Math.pow(this.y-p.y,2)+Math.pow(this.z-p.z,2));
23+
}
24+
25+
toString(){
26+
return "(" + this.x + "," + this.y + "," + this.z + ")";
27+
}
28+
}
29+
30+
var p1: Point2D = new Point2D();
31+
var p2: Point2D = new Point2D(0,5);
32+
33+
var dis: number = p1.distance(p2);
34+
35+
36+
var p3: Point3D = new Point3D();
37+
var p4: Point3D = new Point3D(0,0,5);
38+
39+
var dis2: number = p3.distance(p4);
40+
41+
alert("First:" + p1.toString() + ":" + dis.toString());
42+
alert("Second:" + p3.toString() + ":" + dis2.toString());

ts/AppStart.ts

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
/// <reference path="Game.ts" />
3+
4+
// Create an start the game
5+
var game = new Engine.SimpleGame(1000,500);
6+
7+
for(var i = 0; i< 5; i++){
8+
var color = new Engine.Color(Math.random()*255,Math.random()*255,Math.random()*255);
9+
//alert(color.toString());
10+
game.addBlock(new Engine.Block(new Engine.Box(100*i+10,200+Math.random()*100,50,50),color));
11+
}
12+
game.addActor(new Engine.Player(100,100,100,100));
13+
14+
//var box1 = new Engine.Box(0,0,10,10);
15+
//var box2 = new Engine.Box(0,1,10,10);
16+
//alert(String(box1.collides(box2)));
17+
//alert(String(box1.collides(new Engine.Box(100,100,10,10))));
18+
19+
//alert(String(Algebra.Util.Equals(1,1.2,.1)));
20+
21+
game.start();

0 commit comments

Comments
 (0)