hi,
I am new in Chipmunk and I have a problem:
I am going to make a game with a ball falling down and you could draw a line. The ball should bouncing on this line, but my code doesn´t work. Nothing happens.
Here is my Code:
Code:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [[event allTouches] anyObject];
CGPoint location = [touch locationInView:self.view];
BEX = location.x;
BEY = location.y;
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [[event allTouches] anyObject];
CGPoint location = [touch locationInView:self.view];
ENX = location.x;
ENY = location.y;
}
- (void)setupChipmunk {
cpBody *splineBody = cpBodyNew(INFINITY, INFINITY);
splineBody->p = cpv(BEX+ENX/2, BEY+ENY/2);
cpShape *splineShape = cpSegmentShapeNew(splineBody, cpv(BEX, BEY), cpv(ENX, ENY), 0);
splineShape->e = 1; splineShape->u = 0.1; splineShape->collision_type = 0;
cpSpaceAddStaticShape(space, splineShape);
}
ENX,ENY,BEX,BEY = int
AlphaMensch