Skip to content

Commit

Permalink
rotation basics
Browse files Browse the repository at this point in the history
  • Loading branch information
SlicedBacon committed Feb 27, 2015
1 parent 47fef37 commit 5f0dde0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion Rect.pde
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ public class Rect extends Entity
//act method. called every frame
public void act()
{
pushMatrix();
translate(x, y);
rotate(radians(dir));
rect(x, y, rectWidth, rectHeight);
rect(0, 0, rectWidth, rectHeight);
popMatrix();

}
}
6 changes: 5 additions & 1 deletion physicsEngine.pde
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
int i = 0;

Rect rect;

void setup()
{
rectMode(CENTER);
size(200, 200);
rect = new Rect(100, 100, 20, 20);
//frameRate(600);
}

void draw()
{
background(255);
rect.setDir(45);
i += 15;
rect.setDir(i);
rect.act();
}

0 comments on commit 5f0dde0

Please sign in to comment.