kumareshRajalingam Posted December 4, 2016 Share Posted December 4, 2016 Hello guys I need an sample source code for making an game like angry bird could any one help me for that? Controls be like Up arrow - To increase the angle Down arrow - To decrease the angle Enter key - To shoot the cannon Quote Link to comment Share on other sites More sharing options...
mattstyles Posted December 5, 2016 Share Posted December 5, 2016 Pick a physics library and look through any example they have which contains a few entities (e.g. http://schteppe.github.io/p2.js/demos/collisions.html), and you're 95% there. Most physics libraries (such as P2, matterJS etc) work in a similar fashion, you create a world/engine/simulation, fill it with entities and then render it. Your job will be to add a force to a certain entity (your bird/s) based on angle and some sort of power, let the simulation play out and handle some collision events i.e. when objects collide with enough force they should explode and probably grant you a score, keep track of your 'pig' entities and when they've all exploded you've finished the level. I'm not suggesting this is in any way easy, just that there are quite a few excellent physics libraries out there that handle the most complex bits of a game like this for you. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.