我正在建立一个简单的游戏应用程序,你必须将球从另一个球移开.但是,我的代码有问题,请帮忙.当我构建并运行它时,我收到2条错误消息.我不明白问题是什么.
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
//(X speed, Y speed) vvv
pos = CGPointMake(5.0,4.0);///////// this part here I get an error message saying assigning to CGPoint * (aka 'struct CGPoint*') from incompatible type 'CGPoint' (aka 'struct CGPoint')
}
- (IBAction)start {
[startbutton setHidden:YES];
randomMain = [NSTimer scheduledTimerWithTimeInterval:(0.03) target:(self) selector:@selector(onTimer) userInfo:nil repeats:YES];
}
-(void)onTimer {
[self checkCollision];
enemy.center = CGPointMake(enemy.center.x+pos->x,enemy.center.y+pos->y);
if (enemy.center.x > 320 || enemy.center.x < 0)
pos->x = -pos->x;
if (enemy.center.y …
Run Code Online (Sandbox Code Playgroud)