summary refs log tree commit diff stats
path: root/Classes/Cart.m
diff options
context:
space:
mode:
Diffstat (limited to 'Classes/Cart.m')
-rw-r--r--Classes/Cart.m10
1 files changed, 7 insertions, 3 deletions
diff --git a/Classes/Cart.m b/Classes/Cart.m index 3046be3..45c370c 100644 --- a/Classes/Cart.m +++ b/Classes/Cart.m
@@ -10,7 +10,7 @@
10 10
11@implementation Cart 11@implementation Cart
12 12
13@synthesize sprite; 13@synthesize sprite, immobile;
14 14
15- (id)initWithSprite:(CCSprite*)m_sprite 15- (id)initWithSprite:(CCSprite*)m_sprite
16{ 16{
@@ -19,6 +19,7 @@
19 if (nil != self) 19 if (nil != self)
20 { 20 {
21 sprite = m_sprite; 21 sprite = m_sprite;
22 immobile = NO;
22 } 23 }
23 24
24 return self; 25 return self;
@@ -26,8 +27,11 @@
26 27
27- (void)tick 28- (void)tick
28{ 29{
29 // Move the cart based on acceleration gathered from accelerometer 30 if (!immobile)
30 sprite.position = ccp(MIN(MAX(sprite.position.x+accelX, 16),464), sprite.position.y); 31 {
32 // Move the cart based on acceleration gathered from accelerometer
33 sprite.position = ccp(MIN(MAX(sprite.position.x+accelX, 16),464), sprite.position.y);
34 }
31} 35}
32 36
33- (void)accelerometer:(UIAccelerometer*)accelerometer didAccelerate:(UIAcceleration*)acceleration 37- (void)accelerometer:(UIAccelerometer*)accelerometer didAccelerate:(UIAcceleration*)acceleration