Skip to content

Commit

Permalink
Merge pull request #4 from zainkhan-afk/develop
Browse files Browse the repository at this point in the history
Added sprite loading, but disabled sprite rendering
  • Loading branch information
zainkhan-afk authored Mar 12, 2024
2 parents 97ec753 + fae6b57 commit 6f5b7fe
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
6 changes: 5 additions & 1 deletion AckermannDriving/Car.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@ class Car{

this.carKinematics = new Kinematics(this.carWidth, this.carLength);

// this.carSprite = loadImage('sprites/car_sprite.png');
this.carSprite = loadImage('sprites/car_sprite.png');


// this.carSprite = new Image();
// this.carSprite.crossOrigin = "";
// this.carSprite.src = 'sprites/car_sprite.png';

this.carBaseBodyPts = [[- this.carLength/2, - this.carWidth/2],
[ this.carLength/2, - this.carWidth/2],
[ this.carLength/2, this.carWidth/2],
Expand Down
11 changes: 8 additions & 3 deletions AckermannDriving/Graphics.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@ class Graphics{
DrawCar(car){
// imageMode(CENTER);
// image(this.carSprite, car.position.x, car.position.y);
// drawingContext.drawImage(this.carSprit,mouseX,mouseY);



// Drawing main car body
strokeWeight(3);
stroke(150);
noFill();
fill(150);
// noFill();
beginShape();
for (let i = 0; i < car.carTranformedBodyPts.length; i++){
vertex(car.carTranformedBodyPts[i][0], car.carTranformedBodyPts[i][1]);
Expand All @@ -28,8 +33,8 @@ class Graphics{
}

// Drawing wheel trails
strokeWeight(1);
stroke(0);
strokeWeight(2);
stroke(100);
noFill();
for (let i = 0; i < car.wheelTrail.length; i++){
beginShape();
Expand Down

0 comments on commit 6f5b7fe

Please sign in to comment.