I want to make a image in this case a "plane" shoot I have the air plane image I want to use I want it to move on its own kinda float but able to move around the screen, detect touches and shoot. please help TUTS or anything would be very much appreciate. Thnx for your replies.
yes i do know some but im very new to programming. i Simply want to make my image when you tap on it to fire a shot.
It sounds like you want to have an image view hidden and then when you tap it appears. What you do is make a name for your image view and then make it disappear of reappear: IBOutlet UIImageView *planePicture; in the .h file and then in the .m under your IBAction put: planePicture.hidden = YES; or planePicture.hidden = No; I hope this helped!
I guess what I mean is if I take my image of a plane put it in a UIButton. From here How do I get it to recognize a touche so I can fire a shot??? please somebody help lol
Do you know how to do the animation for your shot? If so, all you do is make a button (declare and all that stuff) in view did load, and put your animation of a shot in the method of the button (in the .m) and then do (view did load) picturePlane.hidden = YES; and then in the button method do picturePlane.hidden = NO; and then the animation. If this doesn't make sense, PM me. The code is for a sprite animation. If I am correct, put this in the .m file in view did load and then @synthesize plane; at the top of .m and then in .h NSTimer* animationTimer; IBOutlet UIImageView *plane; @property(nonatomic, retain) IBOutlet UIImageView* plane; - (void)animatePig; - (IBAction)animate; View did load: animationTimer = [NSTimer scheduledTimerWithTimeInterval1.0/1.0) target:self selectorselector(tick) userInfo:nil repeats:YES]; [animationTimer setFireDate:[NSDate distantFuture]]; plane.hidden = YES; [super viewDidLoad]; } - (IBAction)animate{ [animationTimer setFireDate:[NSDate date]]; } - (void)tick{ [self animatePlane]; } - (void)animatePig{ pig.hidden = NO; UIImage* planeImage1 = [UIImage imageNamed"4.png"]; UIImage* planeImage2 = [UIImage imageNamed"5.png"]; UIImage* planeImage3 = [UIImage imageNamed"6.png"]; UIImage* planeImage4 = [UIImage imageNamed"7.png"]; if(plane.image == planeImage1) plane.image = planeImage2; else if(plane.image == planeImage2) plane.image = planeImage3; else if(plane.image == planeImage3) plane.image = planeImage4; else{ plane.image = pigImage1; [animationTimer setFireDate:[NSDate distantFuture]]; //This effectively pauses the timer plane.hidden = YES; }
I couldn't get it to work I will try it again in the morning. I guess I don't completely understand it either
Ok, so if you want to have a sprite appear when you press a button, and then disappear, then PM your e-mail address and I'll make you an xcode project!
may i ask what is the code to create those objects to appear and disappear? i am doing a whac a mole game and i need help in getting the screen for the mole to appear. thanks
need help in whackamole may i ask what is the code to create those objects to appear and disappear? i am doing a whac a mole game and i need help in getting the screen for the mole to appear. thanks