This code is used for my collision testing, but it only works on 2 sides on each UIImageView. Why does not it work for three parties? This will not work towards the UIImageView or the left and right top and bottom. Why is it just top and left, top and right or lower and right or lower and left? How do I work on at least 3 sides?
int moveX; Let's go; ViewController.h {IBOutlet UIImageView * Circle; NSTimer * time; IBOutlet UIImageView * forum; } - (IBAction) StartGame: (ID) sender; - (zero) moveCircle; - (zero) bounce; @ Endcontroller.m - (IBAction) StartGame: (ID) sender {start.hidden = YES; Time = [NSTimer Scheduled Timer With Time Interface: 0.02 Goal: Self Selector: @Selector (Moving Chakra) User Information: Zero Repeats: Yes]; CircleX = arc4random ()% 11; CircleX = circleX-5; CircleY = arc4random ()% 11; CircleY = circle Y-5; CircleX = arc4random ()% 11; CircleX = circleX + 5; CircleY = arc4random () 11% ;; CircleY = circle Y + 5; If (circle X == 0) {circleX = 1; } If (circle y == 0) {circleY = 1; } - (empty) step circle circle {circle.center = CGPointMake (circle.center.x -circleX, circle.center.y-cycleY); If (Circle Center X <30) {circleX = 0-circleX; } If (circle center.x> 320) {circleX = 0-circleX; } If (Circle Center 28. 28) {circleY = 0-circleY; } If (circle center and 568) {circleY = 0-circleY; } [Self-surge]; } - (zero) bounce {if (cgttexterctactcreate (circle.frame, platform.frame)) {circleY = arc4random ()% 5; CircleY = 0 + circleY; CircleX = arc4random ()% 5; CircleX = 0 + circleX; CircleY = arc4random ()% 5; CircleY = 0-circleY; CircleX = arc4random ()% 5; CircleX = 0-circleX; }}
I have no meaning in your question, but see your code:
Believing that you start with StartGame
, hopefully only happens once:
- You create a timer ( When this game ends, it should be held invalid
- You set
circleX
and circleY
between 5 and 5 in some random condition - Do you set 5 and 15 (again?!)
- between some random
circleX
and circleY
for the status check that circleX
and <
then move the circle :
- You add the circle center to the
circleX
and the circleY
values, then accept those two values, actually the speed is (Well enough) - You check the condition of the circle out of bounds and reject at the right pace << / Li>
- You
> call for more bounce method
- You check that
circle
and forums > CircleY
and circleY
to 0 to 4 - You set a random set
circleX
and circleY
speed from 0 to -4 (then?!)
So what can I say with this code you have 2 views on your view controller, where a Is a static barrier, and the second moves circle
. The circle itself will proceed in some direction based on some random values from its own Stargam
method and tightened harsh borders right away. If the intersection with the board
platform
, the speed in some random negative values between 4 and 0 will change in both cycle X-Y.
What is this issue really? By jumping platform
will increase the circle
towards the top-left corner of the screen, regardless of any side circle
to the platform
From the bounce
method to find the right value for the new speed based on which direction you get from platform
, some if
Details should be
Comments
Post a Comment