★ TouchArcade needs your help. Click here to support us on Patreon.

Im making a very simple SHOOTER game need some Help PLease.

03-01-2009, 06:45 PM
#1
Joined: Feb 2009
Posts: 14
Im making a very simple SHOOTER game need some Help PLease.

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.
03-01-2009, 06:46 PM
#2
Quote:
Originally Posted by CladCreations View Post
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.
so u want a image from your description?

03-01-2009, 07:01 PM
#3
Joined: Jan 2009
Posts: 467
How are you making your app?

Last edited by Ph4ntom4; 03-01-2009 at 07:12 PM.
03-01-2009, 07:07 PM
#4
Joined: Sep 2008
Location: Vancouver, BC
Posts: 784
Do you know any programming languages such as C++ or Objective C?

Please say yes....

Bullet Development (twitter) Bullet Skater // Psychedelic


03-01-2009, 07:56 PM
#5
Joined: Feb 2009
Posts: 14
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.
03-01-2009, 10:16 PM
#6
Joined: Jan 2009
Location: App Tech Studios, USA
Posts: 1,363
Quote:
Originally Posted by CladCreations View Post
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!
03-01-2009, 10:58 PM
#7
Joined: Feb 2009
Posts: 14
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
03-01-2009, 11:39 PM
#8
Joined: Jan 2009
Location: App Tech Studios, USA
Posts: 1,363
Quote:
Originally Posted by CladCreations View Post
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 selector:@selector(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;
}

Last edited by WellSpentYouth; 03-01-2009 at 11:41 PM. Reason: whoops!
03-03-2009, 12:34 AM
#9
Joined: Jan 2009
Location: App Tech Studios, USA
Posts: 1,363
Quote:
Originally Posted by WellSpentYouth View Post
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 selector:@selector(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;
}
Did my post help at all?
03-03-2009, 02:03 AM
#10
Joined: Dec 2008
Location: Sacramento, CA
Posts: 4,568
Lol there's a non-happy smiley in your code

Twitter: @Zincous