We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › OOP help (Car example)
Page Index Toggle Pages: 1
OOP help (Car example) (Read 1863 times)
OOP help (Car example)
Jun 7th, 2010, 1:37pm
 
Hello,

I tried to write the Car class myself (I'm fairly new to programming) and was wondering why the car only moves ('drives') when the rectangle is initialized with the center method.

Thanks!
-Alejandro
Re: OOP help (Car example)
Reply #1 - Jun 7th, 2010, 2:19pm
 
it shouldnt make a big difference, should work as usual, only difference is that your rects are a bit offset as 0,0 of your rect is the Corner and not the Center anymore. If your code doesnt work, the problem is probably somewhere else.
Lets see it...
Re: OOP help (Car example)
Reply #2 - Jun 7th, 2010, 3:43pm
 
rectMode(CORNER);
rect(x,y,8,4);

(x,y)________
|           |
|           | 4
|___________|
     8

rectMode(CENTER);
rect(x,y,8,4);

_____________
|     2     |
|-4-(x,y)   | 4
|___________|
     8
Re: OOP help (Car example)
Reply #3 - Jun 7th, 2010, 3:56pm
 
haha!  Smiley
Re: OOP help (Car example)
Reply #4 - Jun 7th, 2010, 10:17pm
 
not bad, not bad Smiley
Page Index Toggle Pages: 1