How to make a tile based game with cocos2d




















For example, you might make an area where monsters spawn, or an area that is deadly to enter. To insert an Object, select the Insert Rectangle R item from the toolbar.

Your current layer is shown in the bottom left corner. In the latest version of tiled you can also draw other types of object shapes. We just want to select one tile for the player to start in. So choose somewhere on your map and click the tile.

Update: Tyler from GeekAndDad. In this case all we care about is the x,y coordinates, so we pull those out and set that as the position of our player sprite. At the end we want to set the view to focus on where the player is. So now add the following new method to HelloWorldLayer. Imagine this function is setting the center of a camera. See how if the center of the camera is less than winSize. The center of our view is centerOfView, and we know where we want the center to be actualPosition.

So to get the actual position to match up to the center of view, all we do is slide the map down to match! This is accomplished by subtracting the actual position from the center of view, and then setting the HelloWorld layer to that position.

Compile and run the project, and if all goes well you should see your ninja in the scene, with the view moved to show him strutting his stuff! Add the following code to HelloWorldLayer. First, we set our layer as touch enabled in the init method. Then we override the registerWithTouchDispatcher method to register ourselves to handle targed touch events.

Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Stack Gives Back Safety in numbers: crowdsourcing data on nefarious IP addresses. Featured on Meta. New post summary designs on greatest hits now, everywhere else eventually. Linked Related Hot Network Questions. I hope that you will folllow format from Cocos2d book written by Apress. Hope to see how to create tile based game that works on all platforms.

Looking at the chapters, this is going to be a good book. Lots of new stuff I have been wondering about. August has been a busy month for me with one week of vacation already and another coming up. Rest assured, I have two new chapters of the book almost finished.

One will be released this week and one next week. So while progress might be a little slower in August, the normal pace of a chapter a week will be resumed in September. A solid reference for years to come. Do you have any donations place?? I really enjoy the idea behind this book, and I would like to give you something in return for your effort! Stephen, yeah, the new chapter on setting up your projects is almost done.

Waiting for the chapter for so looooooooooooooooong. I had tried to create some games on 2D based. These games are puzzle type and maze type. I will explain how to create these games. This is one of tutrial for creating some games based on cocos2d. In this document, to try creating 2D based breakout games with pazzle and maze.

I will show you same samples to create 2D based games of pazzle type step by step. These demonstrations are confirmed by Microsoft Edge Ver. However, it is not supported to the touch events. In these games, some graphics are downloaded from pikasgame and pipoya. Then, files for sound effect are downloaded from soundeffect-lab.



0コメント

  • 1000 / 1000