Skip to content

Commit

Permalink
move point class
Browse files Browse the repository at this point in the history
  • Loading branch information
ut8ia committed Oct 11, 2016
1 parent dbcdb9f commit 9a5e893
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 62 deletions.
95 changes: 55 additions & 40 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<!--<script src="script.js"></script>-->
<script src="rat_1.js"></script>
<script src="rat_2.js"></script>
<script src="point.js"></script>
<script src="race.js"></script>
<script src="app.js"></script>
</html>
20 changes: 20 additions & 0 deletions point.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//point object

function Point(viewId) {
this.x = 0;
this.y = 0;
this.id = '';
this.state = 'default';
this.fill = function () {
document.getElementById(viewId).insertAdjacentHTML(
'beforeend',
'<div id="' + this.id + '" class="' + this.state + '"></div>'
);
};

this.change = function (state) {
this.state = state;
document.getElementById(this.id).className = state;
};

}
24 changes: 2 additions & 22 deletions race.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// 02 12 22
// Y
//
// ID of "space" obj is "X Y"
// ID of "space" obj is "X,Y"
//
// space obj's statuses :
// "default" - free space
Expand Down Expand Up @@ -139,7 +139,7 @@ function Race(viewId, name) {
}


// rat cretion
// rat creation
this.createRat = function () {
window.r = new rat_1(this);
r.born();
Expand All @@ -159,23 +159,3 @@ function Race(viewId, name) {
}

}

//point object
function Point(viewId) {
this.x = 0;
this.y = 0;
this.id = "";
this.state = "";
this.fill = function () {
document.getElementById(viewId).insertAdjacentHTML(
'beforeend',
'<div id="' + this.id + '" class="default"></div>'
);
};

this.change = function (state) {
this.state = state;
document.getElementById(this.id).className = state;
};

}

0 comments on commit 9a5e893

Please sign in to comment.