弹珠台游戏开发全解析
1. 弹珠台的创建
弹珠台由三个独立的图像及其关联形状组成,分别是 table - top 、 table - left 和 table - bottom 。为了创建弹珠台,我们使用 TablePart 类,它继承自 BodySprite 。
以下是 TablePart 类的接口:
#import "BodySprite.h"
@interface TablePart : BodySprite
{
}
+(id) tablePartInWorld:(b2World*)world position:(CGPoint)pos name:(NSString*)name;
@end
TablePart 类的实现主要是初始化 BodySprite 并设置物体的位置,同时将物体类型设置为 b2_staticBody ,使每个 TablePart 成为非移动对象,这样可以提高性能,并且碰撞时不会影响其位置和旋转。
#import "TablePart.h"
#import "Helper.h"
@implementation TablePart
-(id) initWithWorld:(b2World
弹珠台游戏开发详解
超级会员免费看
订阅专栏 解锁全文
59

被折叠的 条评论
为什么被折叠?



