HI to all,
I am new in game developing part .Can any one help me out how to develop the game .Because Till toady i am on the normal iphone application developing .Can i develop the game by choosing window or view based application .If yes then give me some kind of sample code or link for that.
Thanks in advance
Its better to use a game engine like cocos2d. But u can make games by choosing view based application also. Refer "Apress Beginning iPhone Games Development" it helps u a lot.
you're probably best off using a games engine (google cocos2d) or similar to be honest. They come with their own starting templates that you can use, rather than using a view or window based application.
You should make the object with help of sprite class.You can make Sprite and AtlasSprite classes with help of Apress book. and read all about these classes before use.
Sprite *obj; (in .h file)
//in .m file
obj = [AtlasSprite fromFile:#"img.png" withRows:1 withColumns:1];
//now set the properties of the obj.
//for moving set
obj.x = 20; obj.y = 25; //by default x,y is 0,0
obj.speed = 120; //120 is just for example
obj.angle = 0; //for left to right movement
obj.angle = 180; //for right to left movement
timer = [NSTimer scheduledWithTimeInterval:1/10 target:self selector:#selector(func) userInfo:nil repeats:YES];
-(void)func {
[obj tic:1/20]; //for moving obj. 1/20 is just for example
}
Related
I know there a many questions regarding this topic but they are all very old and I can't find a resource explaining how to do it in cocos2d v3.x and in Swift. I have some PNGs in a folder in SpriteBuilder and I have made it a Smart Sprite Sheet but I don't know what to do from there. The other questions' answers made me believe this would work:
hero.setSpriteFrame("image.png")
I have tried it but there is no method called that.
Thanks
SWIFT CODE
var hero = CCSprite.spriteWithImageNamed("hero.png") as CCSprite;
var frame = CCSpriteFrame.frameWithImageNamed("ImageName.png") as CCSpriteFrame
hero.spriteFrame = frame;
Obj.C CODE
#define SPRITE_CACHE ([CCSpriteFrameCache sharedSpriteFrameCache])
carSprite.spriteFrame = [SPRITE_CACHE spriteFrameByName:#"redCar.png"]
I've been searching some information about Core motion and gyroscope, and I haven't yet found any proper answer.
I'm working with Xcode 5
My question:
How can I make an image (or in this case a player) to go left or right by tilting the iPhone, just like the character in the game called "Doodle Jump"?
I've already got it jumping, but I can't make it move left or right by tilting the iPhone.
I also have a developer account, and I've tried it with an actual device.
Any sort of help would be much appreciated!
1.Create a new Spritekit project:
2.Add the Core Motion Framework
3.Add this code in the 'touchesBegan' method of you MyScene.m file:
sprite.size=CGSizeMake(20, 20);
4.Add this code in the 'update' method of you MyScene.m file:
CMMotionManager* _motionManager;
-(void)update:(CFTimeInterval)currentTime {
if (_motionManager==nil) {
_motionManager=[[CMMotionManager alloc]init];
_motionManager.deviceMotionUpdateInterval=0.25;
[_motionManager startDeviceMotionUpdates];
}
SKSpriteNode *sprite;
for (int i=0; i<self.children.count;i++) {
sprite=[self.children objectAtIndex:i];
sprite.position = CGPointMake(sprite.position.x * _motionManager.deviceMotion.attitude.pitch*10, sprite.position.y);
}
}
You can find a more detailed version here.
Here's a small video with the result of this code
Before downvote please read the question, I also see other question but doesn't find useful.
I have a requirement in my current app, where i needed to play 360º video (Like Panorama). one app on app store doing same Name "GoPano"
http://itunes.apple.com/ke/app/gopano/id459463884?mt=8
I created a framework over the last 2.5 years, which plays back 360° panoramic video playback on iOS, similar to your requirements.
It is compatible with versions 4.3 up to 6.x at this point.
You can download it at www.panframe.com and try if this is what you are looking for.
The framework supplies a UIView that you can easily add as a child and an asset class which you can connect to the view and which will take care of playing spherical panoramic content.
You can look at the interface I used.
You can use it like this dynamically for example in your UIViewController at runtime:
// initialize an PFView
PFView pfView = [PFObjectFactory viewWithFrame:[self.view bounds]];
pfView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
// set the appropriate navigation mode PFView
[pfView setNavigationMode:PF_NAVIGATION_MOTION];
// add the view to the current stack of views
[self.view addSubview:pfView];
[self.view sendSubviewToBack:pfView];
And when you want to play an 360 video asset (from a file URL) you implement the following:
PFView pfAsset = [PFObjectFactory assetFromUrl:[NSURL fileURLWithPath:filePath] observer:(PFAssetObserver*)self];
if ([pfAsset getStatus] != PF_ASSET_ERROR)
{
[pfView displayAsset:pfAsset];
[pfAsset play];
}
Update:
In case some one wants to use it in cordova apps, you can find plugin here
I found these repos useful when creating my own video 360° player:
https://github.com/hanton/HTY360Player
https://github.com/Aralekk/simple360player_iOS
https://github.com/nomtek/spherical_video_player_ios
The last one is mine, and here is it's description.
Google recently released the CardboardSDK for IOS, which supports 360 video playing.
https://developers.google.com/cardboard/ios/
I found that it is embeded player of GoPano. what they done is play video from Java script and with flex.
hi all
i'm beginner to iOS
i'm trying to make a game when i use NSTimer for action a Ball (for example)
and use CGPointMake for posing in the view its so unreal i mean its like an
old pc with low ram (frame frame) i thought i need to use a Framework for THIS
Can any body help me?
-(void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration{
xValue = acceleration.x*80.0;
yValue = acceleration.y*80.0;
ball.center = CGPointMake(ball.center.x + xValue, ball.center.y);
if (ball.center.x < 24.0) {
ball.center = CGPointMake(24.0 , ball.center.y);
}
if (ball.center.x > 296.0) {
ball.center = CGPointMake(296.0 , ball.center.y);
}
}
Definitely go for cocos2d and Box2D for your physics:
http://www.cocos2d-iphone.org/
http://www.box2d.org/
There are plenty of tutorials out there on both.
I'm not sure I completely understand your question.
OpenGL is a good framework to use for game creation, especially graphics rendering on iOS devices.
Here is a good tutorial you might like to follow.
Here:
http://www.iphonedevbook.com/
If you register on the forum, you can download the sample code from the book "Beginning iPhone 3 Development".
Chapter 15 is called "Ball", and has code which rolls a ball around the screen, based on input from the accelerometer.
cocos2d is a nice framework for writing iPhone games
http://www.cocos2d-iphone.org/
I want to make a book rather like The Pedlar Lady for iPad. Each page has some rich text, and then an animation with sound effects that runs automatically after the user flips to a new page.
I have some idea how I could do that programmatically - Cocos2D is looking pretty useful - but what I don't know is how I could work with my artist. What tools could he use, and what would he deliver so that I can just slot each page's animation in with minimal effort.
Your artist can deliver you assets in the form of pngs, mp3s, and movies that have already been scaled to the target device. You can build the book mostly with Interface Builder. Use AVPlayer to play animations and audio on command. Alternatively (and with more memory use) you can animate images with UIImageView. If you need to move assets around the screen, you can use timers and change the origin of each asset's view.
Edit:
MPMoviePlayer is a simple option. The view can be added more directly, but I have found this to be convenient for layout; After configuring a view in IB:
moviePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL fileURLWithPath:asset.path]];
moviePlayer.moviePlayer.controlStyle = MPMovieControlStyleNone;
[moviePlayerView addSubview:moviePlayer.view];
moviePlayer.view.frame = moviePlayerView.bounds;
Now that Apple is allowing Adobe's Flash -> App maker, you might want to look at that.