cocos2d | Mobile App Development | BrainMobi Blogs and News https://www.brainmobi.com/blog Thu, 21 Feb 2019 08:12:35 +0000 en-US hourly 1 https://wordpress.org/?v=5.2.3 Tips To Build iOS Games With Cocos2d https://www.brainmobi.com/blog/cocos2d-ios-games-tips/ https://www.brainmobi.com/blog/cocos2d-ios-games-tips/#respond Tue, 05 Dec 2017 07:54:39 +0000 https://www.brainmobi.com/blog/?p=1529 While developing a mobile game, there’s a lot that you could go wrong with. You could easily mess up with the size of… Read More

The post Tips To Build iOS Games With Cocos2d appeared first on Mobile App Development | BrainMobi Blogs and News.

]]>
While developing a mobile game, there’s a lot that you could go wrong with. You could easily mess up with the size of your game or the way it looks on various screens. But with Cocos2d and our help, you can’t possibly go wrong! We have gone into depths about the game engine and why you should give it a try in a previous blog. Do check it out before you read this blog.

Now that we’re on the same page, let’s look at a few important tips to keep in mind while building iOS games with Cocos2d:

Separate Game Mechanics From Game Content

For many people, it gets a bit difficult to even realize the difference between game mechanics and game content. So let me explain the difference first. Consider one of my favorite games as a child, Contra Force. I have spent countless hours playing it with my cousin since it was one of the few games back then which had the feature of playing co-op. If you think about its fourth mission wherein we were supposed to fight the people on the airplane, the design of the level and the story behind the level and the game is what built up the game content, while the displacement due to the force of the wind built up the game mechanics. I hope this cleared things out. You can see it in all the games involving physics in any form(Mario’s jump, Kamen’s bird, oh I could go on for hours!)
One of the many things you could do to prevent yourself from confusing the two is that you could model the mechanics in code. What this essentially means is that the code of the mechanics should be separate and the code of the levels should be separate. This comes naturally to most coders who have had the habit of using functions very often before getting into game development.

Be Wary of Different Screen Sizes

As a beginner using Android Studio for game development, I always used to build games for my mobile phone so that I could test it better. What I did wrong was that since I made them keeping my mobile’s screen size in mind, I didn’t think about how they looked on other mobile phones. Later when I checked them on my friend’s mobile phone, the games looked weird.
I’m not the only one who has faced this problem, you might have faced this issue as well. So, for beginners and people who miss out on this, here’s a tip: be wary of different screen sizes. Try not to hard code your assumptions and always place objects in a relative manner. In Cocos2d, the content size property can be used to tackle this problem. Use it wisely to ensure that your iOS game looks good on all screen sizes.

Save Time With Composition

Every game has some non-playable characters(NPCs). Each NPC has their own set of traits. Taking Contra as a reference again, you might notice that every enemy has their own way of attacking you. There’s a guy who would keep shooting and walking left. Then there’s a guy who would stick to his spot and crouch and shoot missiles at you. Then there’s…(you get the point!)
So if you were to code each enemy writing down each action of theirs, you would be wasting a lot of time since these characters have at least one action in common, attacking you. Instead of writing these actions separately for every character, you could simply write a function which would contain this action. Now you can use it in every character by calling that function in the character’s block. You can do the same for every action and reuse the function wherever necessary. If you’re wondering whether it can be done using inheritance as well, you can, but there would be limitations to that especially when you have a lot of characters. Using functions instead would save you a lot of time.

If you wish to save more time in making your iOS game, ask BrainMobi to make your game. We are a leading mobile game development company with a lot of valuable experience which reflects in the games we make. Send us your requirements at sales@brainmobi.com to get a free quote!

The post Tips To Build iOS Games With Cocos2d appeared first on Mobile App Development | BrainMobi Blogs and News.

]]>
https://www.brainmobi.com/blog/cocos2d-ios-games-tips/feed/ 0
All You Need To Know About Cocos2D https://www.brainmobi.com/blog/need-know-cocos2d/ https://www.brainmobi.com/blog/need-know-cocos2d/#respond Mon, 04 Dec 2017 12:40:12 +0000 https://www.brainmobi.com/blog/?p=1525 Did you love Apple Inc.’s 2013 iPad Game of the Year award-winning game Badland? Well, it was made on Cocos2d. About Cocos2d It’s… Read More

The post All You Need To Know About Cocos2D appeared first on Mobile App Development | BrainMobi Blogs and News.

]]>
Did you love Apple Inc.’s 2013 iPad Game of the Year award-winning game Badland? Well, it was made on Cocos2d.

About Cocos2d

It’s an open-source software framework. It is mostly used for building apps, games and many other cross-platform GUI based programs which are highly interactive and appealing. It’s split into a lot of branches, the most famous of them being Cocos2d-x, Cocos2d-objc, Cocos2d-XNA, Cocos2d-html5. Its community has developed some independent editors for SpriteSheet editing, font editing, particle editing, Tilemap editing, world editing etc.

Why You Should Go For Cocos2d

Cocos2d is Free

Unlike CryEngine and many others, Cocos2d is absolutely free. Not only is it totally free, but is also royalty-free, so you that the wad of money in your pocket only grows with time. Cocos2d was developed with the help of a large, highly loyal community, so there’s a lot that comes up that you could have for free!

Support, Support Everywhere

As mentioned before, Cocos2d has a loyal community. The community is as helpful as it is loyal. There a lot of developers in its community who know just about everything and they are more than willing to share all of their learnings with you. While learning something new, it is inevitable to find some roadblocks, and when stuck on these roadblocks for too long, you might want to quit learning the language. This never happens with Cocos2d since their community is so helpful that every roadblock of yours is overcome in no time, preventing you from getting bald out of pulling your hair.

Simplicity At Its Best

Cocos2d is incredibly easy to use, owing to its simplicity. Working on three dimensions is a bit scary since an extra dimension means more variables you have to keep track of. This extra dimension is something that Cocos2d skips so the learning curve is pretty good. Moreover, 2D is easier on mind up straight. I have worked on Unreal Engine earlier and I wouldn’t deny, it was scary at the beginning. However, Cocos2d was a lot easier. My childhood has been spent in playing 2D games like Super Mario, Contra and the rest, so making such games myself has been quite a rewarding task for me. Smartphones have mainly relied on 2D games till now so that is something which might make you consider using the engine even more.

It’s Fast

There’s an ongoing myth that the human eye can’t perceive beyond 30 frames per second. In reality, though, the number is a lot bigger(up to 1000 frames per second, according to a few studies). Now, the reason why I mentioned this fact is that it supports 60 frames per second. Trust me, I didn’t say it to anger the PC master race. Anyway, if you keep your code optimal, 60 frames per second is achievable on all devices, even the older ones. It is always better to have a quick game engine, so this engine would be really good if you also find 30 frames per second annoying.

It Has Physics

Not only physics but sounds and level map parser. That’s a lot of things for a lightweight powerhouse, right? I thought so as well. Many game engines have these features as extras which have to be bought but Cocos2d does this for free.

BrainMobi is a leading mobile app and game development company. We are a team of 60+ mobility enthusiasts and have a lot of experience in working on both new as well as old technologies. Our team has worked on Cocos2d and is adept at every possible task on the engine. Send us your requirements at sales@brainmobi.com for a free quote on your idea.

The post All You Need To Know About Cocos2D appeared first on Mobile App Development | BrainMobi Blogs and News.

]]>
https://www.brainmobi.com/blog/need-know-cocos2d/feed/ 0