/*
Declaration of Road,Since the Road will be in
both the directions I would be making an algorithm
to get the road on the canvas and
the the car onto it.
*/
function Car(){}
Car.prototype={
x:0,
y:0,
position:0,
driver:0,
booster:true,
positionNext:0,
getPosition : function(){return this.position;},
setPosition : function(position){this.position=position;},
getDriver : function(){return this.driver;},
setDriver : function(driver){this.driver},
getBooster : function(){return this.booster;},
setBooster : function(booster){this.booster=booster;},
getPositionNext : function(){return this.positionNext;},
setPositionNext : function(positionNext){this.positionNext=positionNext;},
drive : function(newPosition){
/*Code to steer the car to the new box. Either Animate or keep Dynamic*/}
};
/*Making the Booster Class with Appropriate Getters and Setters*/
function Booster(){}
Booster.prototype={
position:0,
x:0,
y:0,
getX : function(){return this.x;},
setX : function(x){this.x=x;},
getY : function(){return this.y;},
setY : function(y){this.y=y;},
getPosition : function(){return this.position;},
setPosition : function(position){this.position=position;}
};
/*Road Block Class*/
function Road(){}
Road.prototype={
x:0,
y:0,
bomb:false,
booster:false,
position:0,
getX : function(){return this.x;},
setX : function(x){this.x=x;},
getBomb : function(){return this.bomb;},
setBomb : function(bomb){this.bomb=bomb;},
getBooster : function(){return this.booster;},
setBooster : function(booster){this.booster=booster;},
getPosition : function(){return this.position;},
drawRoadPatch : function(roadLayer,stage){
var rect = new Kinetic.Rect({
x:0,
y:0,
width:100,
height:100,
fill:'black'
});
roadLayer.add(rect);
stage.add(roadLayer);
...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.