Skip to content

Commit d16623b

Browse files
Kevin SchweigertKevin Schweigert
authored andcommitted
first commit
0 parents  commit d16623b

File tree

13 files changed

+300
-0
lines changed

13 files changed

+300
-0
lines changed

.DS_Store

6 KB
Binary file not shown.

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#watchout
2+
This is a project I completed as a student at [hackreactor](http://hackreactor.com). This project was worked on with a pair.

append version

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
//Moving Enemies
2+
3+
var data = [{'x':1150, 'y':750}, {'x':1150, 'y':750}, {'x':1150, 'y':750}, {'x':1150, 'y':750}, {'x':1150, 'y':750},
4+
{'x':1150, 'y':750}, {'x':1150, 'y':750}, {'x':1150, 'y':750}, {'x':1150, 'y':750}, {'x':1150, 'y':750},
5+
{'x':1150, 'y':750}, {'x':1150, 'y':750}, {'x':1150, 'y':750}];
6+
7+
var update = function(data){
8+
d3.select('body').selectAll('image').data(data).enter().append('image')
9+
.transition()
10+
.duration(1500)
11+
.attr('x', function(d){return d.x*Math.random()})
12+
.attr('y', function(d){return d.y*Math.random()})
13+
.style("height", function(d){return 50 + "px"})
14+
.style("width", function(d){return 50 + "px"})
15+
};
16+
// var update = function(data){
17+
// d3.select('body').selectAll('.enemy')
18+
// .data(data)
19+
// .transition()
20+
// .duration(1500)
21+
// .attr("x", function(d){
22+
// return d.x * Math.random()
23+
// })
24+
// .attr("y", function(d){
25+
// return d.y * Math.random()
26+
// })
27+
// };
28+
29+
update(data);
30+
31+
setInterval(function(){
32+
update(data)
33+
}, 1500);
34+
35+
//__________________________________________________________________________________________________________________
36+
//Draggable Player
37+
38+
var drag = d3.behavior.drag()
39+
// .on('dragstart', function() { circle.style('fill', 'red'); })
40+
.on('drag', function() { lebron.attr('x', d3.event.x)
41+
.attr('y', d3.event.y); })
42+
// .on('dragend', function() { circle.style('fill', 'black'); });
43+
44+
var lebron = d3.select('body').selectAll('.player')
45+
.data([{ 'x': 565, 'y': 365}])
46+
.attr('x', function(d) { return d.x; })
47+
.attr('y', function(d) { return d.y; })
48+
.call(drag)
49+
50+
//__________________________________________________________________________________________________________________
51+
//Collisions
52+
53+
var collision = function(){
54+
var array = [];
55+
56+
var enemyPos = d3.selectAll('.enemy').each(function(d){console.log(d.x)});
57+
// var playerPos = d3.selectAll('.player').each(function(d){
58+
// return d
59+
// })
60+
// console.log(enemyPos);
61+
}
62+
setInterval(function(){
63+
collision()
64+
}, 750)
65+
66+
67+
//__________________________________________________________________________________________________________________
68+
//Current Score
69+
var count = 0
70+
71+
var current = function(){
72+
d3.select('.current').selectAll('span')
73+
.text(count++)
74+
}
75+
76+
setInterval(function(){
77+
current()
78+
}, 750)
79+

asteroid.png

60 KB
Loading

basketball.gif

31.4 KB
Loading

d3.js

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gsw.png

296 KB
Loading

index.html

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<!DOCTYPE html>
2+
<html>
3+
4+
<head>
5+
<link rel='stylesheet' type='css' href='styles.css'>
6+
<link href='http://fonts.googleapis.com/css?family=Orbitron:900' rel='stylesheet' type='text/css'>
7+
</head>
8+
9+
<body>
10+
<center>
11+
<div class="scoreboard">
12+
<!-- Modify the scoreboard when important events occur in your game! -->
13+
<div class="high">High score: <span>0</span></div>
14+
<div class="current">Current score: <span>0</span></div>
15+
<div class="collisions">Collisions: <span>0</span></div>
16+
</div>
17+
</center>
18+
<div class="container">
19+
<svg width="1200" height="800">
20+
</svg>
21+
</div>
22+
<script src="lib/d3.js" charset="utf-8"></script>
23+
<script src='watchout.js'></script>
24+
</body>
25+
26+
</html>

lbj.png

137 KB
Loading

lib/.DS_Store

6 KB
Binary file not shown.

0 commit comments

Comments
 (0)