访问另一个实现文件方法和绘图问题
在 Xcode/cocos2d/box2d 中,我在名为 Level1.m 的 .m 文件中拥有方法,在 Construction.mm 中拥有另一个方法。是否可以从构造中访问 level1s 方法?
还有一个问题,高级程序员如何绘制 x&y 坐标超出屏幕范围的关卡。例如横向卷轴马里奥类型的游戏?
In Xcode/cocos2d/box2d I have methods in an .m file called Level1.m, and another in construct.mm. Is it possible to access level1s methods from construct?
Also another question, how would an advanced programmer plot a level with x&y coords beyond the scope of the screen. For example a sidescrolling Mario type game?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于你的第一个问题......查找继承,基本的面向对象概念,允许您利用和重写方法。如果您不想继承该类,则只需创建该类的实例即可使用其方法。
至于你的第二个问题,我会假装整个屏幕的坐标占据了游戏的整个关卡,但是在玩游戏时,在玩家周围放大(或缩放),以便用户只能看到角色周围的内容。
For your first question.. Look up Inheritance, basic object oriented concept that allows you to utilize and override methods. If you don't want to inherit the class, then simply create an instance of it to use its methods.
As for your second question, I would pretend like the entire screen's coordinates takes up the entire level of your game, but while playing, zoom in (or scale) around the player so that the user can only see what's barely around the character.