Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
3fd8b83
Fixed the script tag for the gun.js file
chasem74 Sep 23, 2018
a2f9bd3
Base of the tower class
chasem74 Sep 23, 2018
9ad8142
Merge remote-tracking branch 'origin/dev-chase' into dev-chase
wisehackermonkey Sep 23, 2018
85cee20
Merge branch 'oran-bullets' into dev
wisehackermonkey Sep 23, 2018
4078165
working multiple bullets
wisehackermonkey Sep 23, 2018
2eacfcf
changed gun.js's fire() parapmaters
wisehackermonkey Sep 23, 2018
b4cb652
cleaned up script.js
wisehackermonkey Sep 23, 2018
ca02519
Merge remote-tracking branch 'origin/oran-bullet-multiple' into oran-…
wisehackermonkey Sep 23, 2018
f2b0ec6
Base of the tower class
chasem74 Sep 23, 2018
38d2860
changed gun.js's fire() parapmaters
wisehackermonkey Sep 23, 2018
eafaf73
working multiple bullets
wisehackermonkey Sep 23, 2018
367a00b
cleaned up script.js
wisehackermonkey Sep 23, 2018
5b6523a
removed reduntand 'tower"
wisehackermonkey Sep 23, 2018
5628185
Merge remote-tracking branch 'origin/oran-bullet-multiple' into oran-…
wisehackermonkey Sep 23, 2018
47e7fb9
refactored gun.js to not include Game(), added tileset files
wisehackermonkey Sep 23, 2018
84a50e1
added background, and player sprite
wisehackermonkey Sep 23, 2018
a61cc89
refactored background
AudioByAri Sep 23, 2018
0b274c3
working death screen on mouse pressed
AudioByAri Sep 23, 2018
2d67a7e
Fixed player movement
AudioByAri Sep 23, 2018
6aefa4c
Fixed player collision with tower
AudioByAri Sep 23, 2018
bea64a7
Fixed shooting
AudioByAri Sep 23, 2018
9512a60
Tower shooting in random directions
chasem74 Sep 23, 2018
d8ed787
Merge branch 'Ari-Collision' of https://github.com/SRJC-Computer-Scie…
chasem74 Sep 23, 2018
b034506
Auto stash before merge of "dev-oran-bullet-collision" and "dev-chase"
wisehackermonkey Sep 24, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
4 changes: 4 additions & 0 deletions data/grass.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<tileset name="grass" tilewidth="32" tileheight="32" tilecount="18" columns="3">
<image source="../../../../../Downloads/submission_daneeklu/tilesets/tallgrass.png" width="96" height="192"/>
</tileset>
28 changes: 28 additions & 0 deletions data/map.tmx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.0" tiledversion="1.1.6" orientation="orthogonal" renderorder="right-down" width="20" height="20" tilewidth="32" tileheight="32" infinite="0" nextobjectid="1">
<tileset firstgid="1" source="grass.tsx"/>
<layer name="Tile Layer 1" width="20" height="20">
<data encoding="csv">
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11
</data>
</layer>
</map>
Binary file added dev_screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/farmer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/front_man.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/gameOver.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/grass.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/grass2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/grass3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions img/guy.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<tileset name="guy" tilewidth="16" tileheight="16" tilecount="12" columns="3">
<image source="../../../../../Downloads/Green-Cap-Character-16x18.png" width="48" height="72"/>
</tileset>
Binary file added img/house1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions img/map.json.p10876
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{ "height":20,
"infinite":false,
"layers":[
{
"data":[11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11],
"height":20,
"name":"Tile Layer 1",
"opacity":1,
"type":"tilelayer",
"visible":true,
"width":20,
"x":0,
"y":0
}],
"nextobjectid":1,
"orientation":"orthogonal",
"renderorder":"right-down",
"tiledversion":"1.1.6",
"tileheight":32,
"tilesets":[
{
"firstgid":1,
"source":"grass.tsx"
}],
"tilewidth":32,
"type":"map",
"version":1,
"width":20
}
Binary file added img/tree.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@
<script src="p5.collide2d.js" type="text/javascript"></script>
<script src="p5.play.js" type="text/javascript"></script>-->

<script src="./libraries/p5.collide2d.js" type="text/javascript"></script>

<script src="./libraries/p5.tiledmap.min.js" type="text/javascript"></script>
<script src="./libraries/game.js" type="text/javascript"></script>

<script src="./scripts/player.js" type="text/javascript"></script>
<script src="./scripts/bullet.js" type="text/javascript"></script>
<script src="./scripts/gun.js" type="text/javascript"></script>
<script src="./scripts/tower.js" type="text/javascript"></script>


<script src="sketch.js" type="text/javascript"></script>
Expand Down
31 changes: 23 additions & 8 deletions libraries/game.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,25 +92,40 @@
this.entities = [];
this.group = [];
this.player;

this.despawn = false;

// this.screenwrap = false;
this.willdespawn = false;

this.include = function(entity) {
this.entities.push(entity);
}
this.includes = function(entity) {
for (var i = 0; i < entity.length; i++) {
this.entities.push(entity[i]);
}
}
this.setplayer = function(player){
this.player = player;
}
this.run = function(){
this.run = function(player,func){
for (var i = 0; i < this.entities.length; i += 1) {
//check if the entitis array has objects within it
if(this.entities && this.entities[i]){
// this.checkCollisions(player,func);
this.entities[i].run();
this.despawn(this.entities[i],i);
// if(this.despawn === true){
// this.despawn(this.entities[i],i);
// }
}
}
}

this.checkCollisions = function(sprite, func){
for (var i = 0; i < this.entities.length; i += 1) {
this.collisions(sprite, this.entities[i], func);
}
}
/*this.run = function() {
for (var i = 0; i < this.entities.length; i += 1) {
if(this.willdespawn){
Expand Down Expand Up @@ -181,11 +196,11 @@
this.name = name || "default";
this.type = type || "rect";

if (typeof img === "string") {
this.img = loadImage(img);
} else {
this.img = DefaultImage();
}
// if (typeof img === "string") {
// this.img = loadImage(img);
// } else {
this.img = img || DefaultImage();
// }
this.visable = true;

var target = createVector(0, 0);
Expand Down
Loading