![]() Delete copy from the list in level editor.Delete model from the level file handler.Remove the visual object from the scene.Detect which object was touched or selected by the user.Think for a minute about the steps required to delete an object in your level: Looks like you’re going to need some object deletion methods. The ability to add objects to the screen is pretty rewarding, but your screen is getting more crowded by the second and - whoops! You anchored a rope where you didn’t mean to. ![]() Getting Started: Removing Objects From Your Level This project starts where you left off in the last tutorial, so make sure you have a copy of the project from part 2. In this last portion of the tutorial, you’ll add the ability to delete objects, move them around, complete the level save and reset mechanism, and implement multiple level handling to round out your level editor! Then you finished off by adding the ability to create new objects and place them on the screen. In the second part, you added a popup menu along with a state machine to control the flow of the editor and provide a visual indicator of the current mode of the editor. In the first part of this three-part tutorial, you designed the XML storage mechanism of your level files, implemented some model classes to hold your rope and pineapple data, and finished off by creating the load file functionality of your level editor. These methods then use the two mutable dictionaries to retrieve the needed menuItem and action (when needed) and then apply the desired effect.Welcome to the third part of a tutorial series that shows you how to make a level editor for the Cut the Verlet game that was previously covered on this site. Methods are then created for general things like buttonNamed:runActionNamed: and buttonNamed:setPosition. Then I use helper functions to create the menuItems and actions and store them in the mutable dictionaries. I prefer instead to create two NSMutableDictionary's as instance variables, one called menuButtons and one called menuButtonActions. Then when each menu item is needed I animate it by moving or fading it into place.Ģ) I avoid using tags. You can also use any other actions like CCFadeIn, CCSkewTo, CCScaleBy, etc to do cool effects on the individual menu items.ġ) I create all of the menu items when the node that owns the menuItems is created. The downside of this approach is that you lose the ability to automatically align the menu items and they act as separate menus, but that is a small cost to the upside of being able to move the menu items around in any way to create interesting effects. This of course will work with any of the CCMenuItem subclasses, such as the CCMenuItemFont that you are using. Then I manually position the CCMenuItemSprite/CCMenuItemFont menu items (not the CCMenu) using their position property at their start location and then use CCMoveTo action to move the menu items around when needed. The way that I move menus in my games is to create each menu item in it's own separate CCMenu and set each CCMenu at position 0,0. Think of the menuItems as just characters in your game. (id) initĬCLayerColor *bg = ĬCMenuItemFont *menu1 = ĬCMenuItemFont *menu2 = ĬCMenu *menu = How do I do that? In my code menu just overwrites itself so I have those items on top of each other. When you click new game I want credits to shift down and open two new menu items, like that: New Game They are aligned vertically, like this: New Game I have a menu of two items - New game and Credits.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |