SpriteKit: Should I pan the camera or move the background? - ios

When building a game with SpriteKit, with a platformer game (like Doodle Jump for example), is it preferable to move the camera up, or the background nodes down ?
What is the standard practice in other frameworks ?

MOVE THE CAMERA!!!
One of the weirdest things about 2D game engines is that it often takes them a series of versions to get a camera.
They should be born with them.
SpriteKit was no different, it took forever to get a camera.
Now that it has one, never ever think of not using it.
Will make your life a million times simpler.
I can think of no exceptions, but look forward to being proven wrong.

move background was HOTFIX until proper cam support added.
use the cam. its easy and fun. no reason to not imo.

Related

How to make a 2D model(moveable) like gomoji app?

I want to make a 2D model in iOS programatically. Like this:
This is taken from the app Gomoji.
I googled it but not get the proper solution.
This character is also moving so it can move hands and the legs meanwhile I want to change the colour of the hands etc.
Could it be possible with SpriteKit, SceneKit, gif, SVG or anything else?
This is an incredible amount of work in code, with SpriteKit and actions.
You might be better off using the puppet features of After Effects to creation motion frame sequences, and then bring them into SpriteKit and string them together and jump between the sequences as necessary.
Start here, to understand the puppetry tools in AE:
https://helpx.adobe.com/after-effects/using/animating-puppet-tools.html
Once you've learnt the lingo, head on over to youtube to pick up tips on how to do 2D arms, head wobbles, etc.
There's also a face animator in the latest versions of After Effects, that might be helpful, too.
Generally speaking, this is still a lot of work. And a lot of fiddling to get it to look "just so". But doing this visually, with manual mouse controls and instant playback before exporting image sequences from AE will be lightyears faster than attempting to do this with joints and code in SpriteKit or any other game engine.

How to move "obstacle" objects. Corona SDK Physics Box2D. Physics Update?

I'm trying to understand the proper way to move "obstacle" objects in corona/box2d. I want to know how to write my code so that the movement is deterministic and in-step with the physics engine. Is this possible?
I'm familiar with Unity which has a physics update (FixedUpdate). Where you can add a bit of code to execute on every physics step. This keeps the physics deterministic, frame and system time independent.
For example, in my game I want to do things like: Make a platform that moves back and forth, make an object that scales up and down in size. I would still like the physics to work properly and allow the ball in my game to bounce off of these for example. Depending on the case, I imagine that I should use either kinematic or dynamic bodies.
I've searched around and the way to periodically manipulate these objects is to use:
timer.performWithDelay. But this has an issue mentioned in the docs "Timers run on system time. If the app is suspended, running timers will not be automatically paused"
Listening to an enterFrame event. But this has a similar issue, if the frame rate drops then the object won't be moved enough. We can use delta time to deal with this, but this has determinism issues (moving an object too much on a lag spike).
transition.to. I'm guessing this is implemented with timer.performWithDelay and has the same issues.
I don't think that any of these will behave deterministic. Any suggestions? Thanks for the help.
You should really use:
object:setLinearVelocity(xVelocity, yVelocity)
or
object:applyForce(xForce, yForce)
instead of transition.to.

Physics engine or not for making a Pendulum in iOS?

I'm trying to replicate the pendulum effect as seen in the old game "Gold miner", if you ever played it before. Do I need to use a physics engine for that, or not? I heard that Box2D is preferred over Chipmunk when it comes to ropes, but do I really have to join two objects together with a rope to accomplish this pendulum effect? I'd love to do it without a physics engine, but if I have to use one I think I would pref chipmunk as it comes with Cocos2d v3. (In short, whats the best way of making a pendulum that swings forever and can be lowered and raised)
Im' a complete n00b when it comes to physics engines, never used one before, only made non-games apps before :/ Any help is very appreciated =)
You mean the grappling hook in that game? That's absolutely not physics, or at least can be done easily without a physics engine. At best you may want to use the physicss engine's raycast collision detection methods (if any).

How should I do this (Game)?

Right now I have coded about 80% of my game and the remaining 20% is the actual game part of it. I need to know how I should go upon actually making the game part.
Pretty much it will be somewhat similar to Doodle Jump. There will be gravity, the accelerometer, and a spawn system for platforms. I need to know if I should use UIKit or Cocos2D for this.
I know I can do gravity and use the accelerometer easily using UIKit but I am worried about the platform part. My 'Doodle Jump character' is not a regular square or rectangle so should I just crop it as best I can? The reason I am worried is because say the character falls on a platform, so his body could be a little off since CGRectIntersectsRect does not have pixel collision detection, so do you think it is fine the way it is?
If you need more info or aren't sure what I am trying to do, just let me know. In the end I just need to know if I should use Cocos2D or UIKit.
Please let me know your thoughts.
Thanks!
My answer would be that, while you may be able to develop the game in UIKit, my suspiction is that it will be better in the long run to do it in Cocos2D. Not only will you have tools which are better for doing stuff like collision detection, you can also use a Physics Engine to handle the gravity and things like that. Basically, Cocos2d was made to do exactly the kinds of things you want to do, and UIKit wasn't...it was made for user interfaces.
Still, the collision detection you do will, mostly likely, not need to be down the level of individual pixels. One rectangle might be enough, or perhaps you can use several to get more accuracy. So can you pull it off in UIKit...maybe, but I bet your game will turnout better overall if you use Cocos2d.

Making a table tennis game

I am very interested in making a table tennis game. It will be in 2D specially as I have no experience dealing the 3D. I have built aero-fighter in java. No i am learning XNA and want to make a table tennis (ping pong) video game in it. It will be human vs computer game.
I have some idea to do the task. But I am eager to know how the tennis game industry move their player ?
There are several question about the game --
***What will be the best to create such a game in 2D or 3D ?
How can i move the ball in 2D game? The equation of the ball move for top,under,flat shot or spin?
How can i move my player?
How can i spin the bat of player and the ball?*
First of all my idea is , making a sprite sheet of some special move for such -
Forehand counter hit, Backhand counter hit, Forehand push, Forehand serve, Backhand Serve... etc.
But it seems to boring and time consuming a lot. What is the best idea to handle such things or this problem?
I do not know the idea to movement of the tt ball. How can i use the spin in the ball and how can i show the spin -- Is it with the sprite?
Please help me if anyone know anything about it. I also like to have some links to get the concept of the video game....
I recomend you get confident with 2D games before you start with 3D. 3D is much more complex and your unlikely to get anywhere if you try to run before you can walk.
The rest of your question is a little broad to answer properly, I suggest you go through the tutorials on app hub and raise a new topic if you need help with a specific part.
If you become familiar with a physics engine such as farseer (harder to initially learn, better in the long run) or Physics2D (easy to pickup, but a little limiting) you could create a pong clone in under an hour I would say.

Resources