managing sprite kit multiplayer world node - ios

I've been working on a 'side scroller' sprite kit game (not really side scroller, you can move in any direction) and the apple docs/stackoverflow answers say to make a world node as the child of the scene, and move the world node instead of the character sprite.
does this suggestion change for a multiplayer game where there are multiple character sprites moving inside the same world node? Because in this case, one sprite moving changes the world for everybody.

The suggestion still applies in multiplayer. Normally you have only one local player, so the "camera" will still be following that particular player and none other.
In local multiplayer (2 players playing on same device) you would probably have the camera follow the mid point between the two players. But it's still the same principle.

Related

How to spawn power ups and detect when they are picked up without enemies being to interact with them

I am currently making a game with sprite and the spritekit library, and I am trying to add power ups. I have tried to use physics bodies to detect when the player touches the power up, however that has not worked for me as the enemies are also able to interact with it. This is a problem, as I only want the player to be able to pick up the power up and have enemies walk straight over the power ups.(The game is top down) I was wondering how I could achieve this. Thank you.
There are a lot of different ways to achieve this.
You could add in some code to the power-up sprite that checks that the colliding sprite is the player.
You could also add in some code to the enemy sprite so that when it collides with the power-up sprite nothing is done.
I'd recommend looking up some tutorials on game development with Swift.
Good luck!

World of Warcraft lau addon- move towards player's side

I am trying to create a World of Warcraft addon which allows a player to move towards the side of a player. Just like the follow function but instead of walking behind the player at his side. I was thinking on getting the player's location with UnitPosition and make the player walk towards that location by adding:
math.cos(direction player is facing in radians)*(length)
math.sin(direction player is facing in radians)*(length)
This is not possible today using Blizzard's current API.
Player movement addons were possible during the early days of Vanilla. People made auto-run GPS-style addons to help characters auto-travel on foot from one town to another.

Objects and Players falling through static ground

I just started to learn how to use spritebuilder since basically everyone told me it saves a lot of time and easy to integrate things, but I am running to an issue where the objects and players that are suppose to sit on the ground fall through.
You need to use a single CCPhysicsNode that contains all the physics objects of your game.
Your setup effectively creates two separate physics worlds that won't interact with each other, therefore rock and guy will never be able to "make contact" with ground.
Interestingly you tagged this with sprite-kit so if you are using the (not officially released, no longer in development) SpriteBuilder version that supports Sprite Kit, know that CCPhysicsNode will not function at all. The SpriteBuilder Sprite Kit version does not support physics.

How to add Bodies to a SKPhysicsWorld

I'm developing a running game for iOS devices and have run into a problem. I created a subclass for a game tile which is 4 screen lengths long. The game tile will have some nodes which are obstacles. I have a scene which creates the player, some background decorations, and particle systems. I need to add the obstacle nodes to the physics simulation in the scene so that I can detect when they contact. I'm not sure how to do that... Is there another solution that would be simpler? Thanks in advance for your help.

Sprite Kit physics variables comparing to Cocos2d+Box2d

I trying to rewrite simple game (developed by me with Cocos2d+Box2d sometime ago) using Sprite Kit framework. Everything looks much simpler in Sprite Kit, which is great, but I have a problem adjusting physics world parameters in the new project. I have noticed that sprites created using exactly same graphic images (all have basic rect-based bodies) have four times lower mass in Sprite Kit than it had in Cocos2d+Box2d. Setting bodies density to 4 solve the problem, unfortunately that's not the main issue. It looks like the same problem with 4-time multiplier works for all forces in the physics world. I have done some testing in Sprite Kit and create a body with mass four time higher than in Cocos2d+Box2d, I have also set the world gravity to be four time lower than in Cocos2d+Box2d. As a result physic in both projects (first using Cocos2d+Box2, second using Sprite Kit) behaves similarly. I can't find anything like PIXEL_TO_METER_RATIO (that was available in Box2) in Sprite Kit. Is there any option that allows to adjust the physics world in Sprite Kit to behave like in Cocos2d+Box2d without multiplying all forces, masses etc? Maybe there is some kind of configuration property that allows to adjust it. If I leave the same values for gravity, mass and forces in Sprite Kit that I was using in Cocos2d+Box2d everything in the game will be simulated too fast. My question is how to deal with problems like this when migrating from Cocos2d with Box2d to Sprite Kit framework?
The only solution is to re-tweak the forces and other settings until things feel right.
Internally Sprite Kit uses Box2D but we have no way of knowing if and how Apple may have modified it. What is known is that they use different default settings for the Box2D world which means physics values can not be ported as is and expect the same results.
I believe this was discussed in the developer forum (under Sprite Kit) where someone investigated the actual numbers for changed settings. Note that these are settings in Box2D's code most users won't even consider to modify, so we have to assume Apple had their reasons to change them in the first place.

Resources