Well, it seems sizes/bounds are still off a little bit, but this is still good progress.
authordsc <david.schoonover@gmail.com>
Tue, 24 May 2011 20:21:13 +0000 (13:21 -0700)
committerdsc <david.schoonover@gmail.com>
Tue, 24 May 2011 20:21:13 +0000 (13:21 -0700)
src/game/QQGame.mm
src/game/actor/QQUnit.h
src/game/actor/QQUnit.mm
src/game/actor/unit/QQTank.mm

index 51b05b4..985c53b 100644 (file)
@@ -1,5 +1,6 @@
 #import "QQGame.h"
 #import "game/actor/unit/QQTank.h"
+#import "game/actor/QQUnit.h"
 #import <Box2D/Box2D.h>
 
 
@@ -36,7 +37,8 @@ static QQGame* _CurrentGame = NULL;
         _actors = [[NSMutableArray alloc] initWithCapacity:10];
         _world = [[QQWorld alloc] init];
         
-        [[[QQTank alloc] init] autorelease];
+        [[[QQTank alloc] initAtX:50 y:50  width:50 height:50 color:0xFF0071] autorelease];
+        [[[QQUnit alloc] initAtX:75 y:100 width:50 height:50 color:0x4596FF] autorelease];
         
         [self addEventListener:@selector(onEnterFrame:) atObject:self forType:SP_EVENT_TYPE_ENTER_FRAME];
     }
index e1b509d..e963b45 100644 (file)
@@ -18,6 +18,7 @@
 - (void) setShapeFromFile:(NSString*)filename;
 
 /// initializers
+- (id) initAtX:(float)x y:(float)y width:(float)w height:(float)h color:(uint)color;
 - (id) initAtX:(float)x y:(float)y withShape:(SPDisplayObject*)shape;
 
 
index 1687b13..869930f 100644 (file)
 /// initializers
 
 - (id) init {
-    return [self initAtX:50 y:50 withShape:[SPQuad quadWithWidth:50 height:50 color:0xff0000]];
+    return [self initAtX:50 y:50 width:50 height:50 color:0xff0071];
+}
+
+- (id) initAtX:(float)x y:(float)y width:(float)w height:(float)h color:(uint)color {
+    return [self initAtX:x y:y withShape:[SPQuad quadWithWidth:w height:h color:color]];
 }
 
 - (id) initAtX:(float)x y:(float)y withShape:(SPDisplayObject*)shape {
     if ((self = [super initAtX:x y:y])) {
         self.shape = shape;
         
-        float px = self.world.scale;
+        float dblpx = 2*self.world.scale;
         b2PolygonShape box;
-        box.SetAsBox(shape.width/px, shape.height/px);
-        self.body->CreateFixture(&box, 5.0f);
+        box.SetAsBox(shape.width/dblpx, shape.height/dblpx);
+        self.body->CreateFixture(&box, 1.0f);
     }
     return self;
 }
index 8587589..cb6192a 100644 (file)
@@ -15,9 +15,9 @@
 
 @synthesize coolAtk = _coolAtk;
 
-- (id) init {
-    if ((self = [super init])){
-        self.coolAtk = [QQCooldown cooldownWithDuration:2];
+- (id) initAtX:(float)x y:(float)y withShape:(SPDisplayObject*)shape {
+    if ((self = [super initAtX:x y:y withShape:shape])){
+        self.coolAtk = [QQCooldown cooldownWithDuration:0.5f];
         [self.game addEventListener:@selector(onTouch:) atObject:self forType:SP_EVENT_TYPE_TOUCH];
     }
     return self;