Skip to content

Commit

Permalink
Fixing units and start position
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Lee committed Oct 23, 2011
1 parent 5ba7ab7 commit 9480013
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
18 changes: 13 additions & 5 deletions public/javascripts/turtle.js
Expand Up @@ -11,12 +11,19 @@ function Turtle (canvasElement, canvasElementArrow) {
this.canvas = null;
this.canvasArrow = null;
this.extraArrowCanvas = false;

// real position of zero point
this.xReal = -249;
this.yReal = 180

// position of zero point
this.x0 = 0;
this.y0 = 0;

// actual position
this.x = 0;
this.y = 0;
this.x = this.xReal;
this.y = this.yReal;

// angle of rotate
this.angle = 0;
// pen is down
Expand Down Expand Up @@ -67,7 +74,9 @@ function Turtle (canvasElement, canvasElementArrow) {
this.right(-1*angle);
}

this.forward = function(step) {
this.forward = function(step) {
// Convert to a healthy amount of movement onscreen
step = Math.ceil(step * 50);
var rad = this.angle * Math.PI / 180;
var ox = this.x;
var oy = this.y;
Expand Down Expand Up @@ -104,7 +113,7 @@ function Turtle (canvasElement, canvasElementArrow) {
}

this.home = function() {
this.x=0; this.y=0;
this.x=this.xReal; this.y=this.yReal;
}

this.hide = function() {
Expand Down Expand Up @@ -132,7 +141,6 @@ function Turtle (canvasElement, canvasElementArrow) {
} else {
this.canvasArrow = this.canvas;
}

this.x0 = Math.ceil(this.canvasElement.width() / 2);
this.y0 = Math.ceil(this.canvasElement.height() / 2);
this.clean();
Expand Down
4 changes: 2 additions & 2 deletions public/javascripts/userInterface.js
Expand Up @@ -373,10 +373,10 @@ $(document).ready(function(){
ResizePanels();
TranslateText();
setEventForElemets();
LoadExamplesList();
//LoadExamplesList();
turtle = new Turtle($('#canvas'));
turtle.draw();
$.get('lang/'+lang+'/syntax.html',function(data) {
$.get('/javascripts/lang/'+lang+'/syntax.html',function(data) {
$('#syntax').html(data);
});
});

0 comments on commit 9480013

Please sign in to comment.