GET Game Story / Sudo Null IT News FREE

The article will be about creating my second Humanoid game on the hybridise-platform Cocos2D-x engine (v3.1). The code is mainly in C ++, in some places Coffee and Lua. I will try to briefly speak for about the main points of ontogeny.

Introduction

Exactly a yr has passed since I badly distinct to draw into the diligence. Then the development for maneuverable platforms seemed incredibly bright, and the development of such relatively simple games is two-needled. As an 18-twelvemonth-old pupil with little programming and graphics skills, just with great ambitions, I wanted to do something of my have, something huge and perfect. Reality quickly put in place and it was decided to do something small but make the most of all my experience and skills. The absence of time limits and the lack of obligation to themselves stretched the growing of the gage and access to Google Play took place already at the end of March of the current (2014) class. Despite the very warm reviews on various forums, the results were non at all pleased - 200 downloads for the whole time and close to 0.30 € per advertisement.

The ordinal pancake is lumpy

Disappointment only added hullabaloo. After analyzing the failure and recital a little literature, afterward a month and a half I decided to indite something simple to invest in a calendar month operating theatre two of development. Nobelium sooner said than done! I wanted to make a puzzle. The essence of the game is that the icon and image elements are given in different forms (translucent and inverted, for example) and with simple manipulations you need to put them in situ.

First level


Cocos2D-x

Cocos2D-x - port of the hot locomotive engine for iOS. Out-of-school and cross-platform. If you merely settle to lead off making games for mobile devices and don't know which engine to choose, be sure to look at it as an pick.

Key Benefits:

  • spoil-platform
  • C ++
  • development in Windows, followed past porting to Humanoid
  • Lua support
  • open generator

The deficiency of full software documentation and lessons complicates the start of cultivate with the engine, but in the main it proved to comprise identical goody-goody. In add-on, the biotic community is constantly expanding its functionality and documentation. Allows you to write 2D games of nigh any complexity, since you can call OpenGL ES functions directly.

If soul is interested, I can write a gnomish tutorial on creating "Hello, world!" and highlights.

Concept

So, as mentioned above, the concept of the game is that a project is given and some of its parts (elements) are scattered in variant places. The player's task is to put all the elements in their target. Elements can have different properties, for representative: rotation, transparency, resizing, etc. There should also be the ability to create different forms and contrastive behaviors.

Rotating Level Example


Intent

In that respect is no opportunity to hire a professional designer. It was decided to make the design as simple as doable, without unnecessary details and it seems to me that I have adequately coped with this project.

Level selection menu



Level completion

Left - exit to the level selection computer menu, center - image name and author, right - conk out to the succeeding level.

I used a screenshot of one of the levels As icons for Google Play and the coating itself.

Altogether kinds of icons


Level implementation

It is clear from the description that the of import task is to create such code that without problems would allow you to create different levels without recompilation, and at the same prison term maintain sufficient tractableness to create elements of other types. For these purposes, XML and Lua were elect. XML describes the level, position of elements, their position on pictures, material body, transparency, size, etc. Information technology also has tags into which you bum insert pieces of code written in Lua.

An example of describing one of the levels in XML

                                                                                          e4Opacity = 5 			e4BeginOpacityAnimation = inconstant 			element:setOpacity(e4Opacity)                                                              local dX = disturb:getLocation().x - touch:getPreviousLocation().x 			local dY = touch:getLocation().y - touch:getPreviousLocation().y 			local scale = level:getScale() 			element:setRotation(element:getRotation() + dX / 2 / scale+ dY / 2 / weighing machine)                                                              if not e4BeginOpacityAnimation then  				return  			close 			if 150 > e4Opacity past  				e4Opacity = e4Opacity + 1 				element:setOpacity(e4Opacity)  			end                                                              e4Opacity = nil 			e4BeginOpacityAnimation = nil                                                                                                  e3Opacity = 5 			e3BeginOpacityAnimation = false 			element:setOpacity(e3Opacity)                                                              local dX = tactual sensation:getLocation().x - touch:getPreviousLocation().x 			local anaesthetic Dy = touch:getLocation().y - tactile sensation:getPreviousLocation().y 			local scale = level:getScale() 			element:setRotation(element:getRotation() + dX / 2 / scale+ dY / 2 / scale)                                                              if non e3BeginOpacityAnimation and so  				return  			ending 			if 150 > e3Opacity so  				e3Opacity = e3Opacity + 1 				element:setOpacity(e3Opacity)  			end                                                              e3Opacity = nil 			e3BeginOpacityAnimation = nil 			e4BeginOpacityAnimation = geographic                                                                                                  e2Opacity = 5 			e2BeginOpacityAnimation = false 			constituent:setOpacity(e2Opacity)                                                              local dX = touch:getLocation().x - touch:getPreviousLocation().x 			local dY = touch:getLocation().y - touch:getPreviousLocation().y 			local scale = level:getScale() 			element:setRotation(element:getRotation() + dX / 2 / scale+ dY / 2 / scale)                                                              if not e2BeginOpacityAnimation then  				return  			end 			if 150 > e2Opacity then  				e2Opacity = e2Opacity + 1 				component:setOpacity(e2Opacity)  			end                                                              e2Opacity = nil 			e2BeginOpacityAnimation = nil 			e3BeginOpacityAnimation = true                                                                                                  e1Opacity = 10 			e1BeginOpacityAnimation = false 			element:setOpacity(e1Opacity)                                        e1BeginOpacityAnimation = true                                          localised dY = touch:getLocation().y - touch:getPreviousLocation().y 			local anesthetic dX = bear upon:getLocation().x - touch:getPreviousLocation().x 			local scale leaf = level:getScale() 			element:setPosition(element:getPositionX() + dX / scale, element:getPositionY() + dysprosium / scale of measurement)                                                              if not e1BeginOpacityAnimation then  				return  			destruction 			if 200 > e1Opacity then  				e1Opacity = e1Opacity + 2 				element:setOpacity(e1Opacity)  			end                                                              e1Opacity = goose egg 			e1BeginOpacityAnimation = nix 			e2BeginOpacityAnimation = true                                                                                                  local dysprosium = touch:getLocation().y - touch:getPreviousLocation().y 			topical dX = touch:getLocation().x - touch:getPreviousLocation().x 			local scale = level:getScale() 			element:setPosition( factor:getPositionX() + dX / scale, component:getPositionY() + Dy / scale)                                                                                                  local dY = touch:getLocation().y - touch:getPreviousLocation().y 			local dX = touch:getLocation().x - touch:getPreviousLocation().x 			local scale = point:getScale() 			element:setPosition( ingredient:getPositionX() + dX / scale, element:getPositionY() + dY / scale)                                                                                                  local dY = touch:getLocation().y - touch:getPreviousLocation().y 			local dX = trace:getLocation().x - soupco:getPreviousLocation().x 			local scale = level:getScale() 			chemical element:setPosition( element:getPositionX() + dX / scale, element:getPositionY() + dysprosium / scale)                                                                                                  local dY = concern:getLocation().y - stir:getPreviousLocation().y 			local anaesthetic dX = reach into:getLocation().x - touch:getPreviousLocation().x 			local surmount = level:getScale() 			element:setPosition( element:getPositionX() + dX / scale, element:getPositionY() + dY / scale)                                                                                

Exploitation Lua, you can write functions such as:

  • onCreate - called when an element is created
  • onTouchBeganFunction - called when you "touch" an element
  • onTouchMovedFunction - called when a touch is affected
  • onTouchEndedFunction - called when the touch ends
  • onUpdateFunction - known as when an item is updated
  • onDestroy - called when an element is ravaged

Variables such equally the constituent itself, constituent sprite, form sprite, level and level sprite are transferred to each use. In the "onTouch" function, a "Concern" type varied is also transmitted, which has data such as the touch position or previous position. Referable the fact that Cocos2D-x supports Lua, you can work directly with Cocos2D-x functions and objects by passing them as arguments. Such an implementation of the levels clad to be quite effective and very whippy (because you can even, for example, close the courageous by clicking on an element or control other elements).

The carrying out of calling Lua-functions of elements connected Cocos2D-x looks like this (victimisation the onCreate function, which is titled when an element is created):

Hidden textual matter

              if (!m_scriptFunctionOnCreate.empty()) 	{ 		LuaEngine* engine = LuaEngine::getInstance(); 		LuaStack* luaS = locomotive->getLuaStack(); 		luaS->executeString(m_scriptFunctionOnCreate.c_str()); 		lua_getglobal(luaS->getLuaState(), "onCreate"); 		luaS->pushObject(this, "200.Node"); // element 		luaS->pushObject(m_sprite, "cc.Sprite"); // element faery 		if (m_shapeMaskSprite != nullptr) 		{ 			luaS->pushObject(m_shapeMaskSprite, "cc.Sprite"); // shape 		} 		else 		{ 			luaS->pushNil(); 		} 		luaS->pushObject(getParent(), "milliliter.Node"); // level 		luaS->pushObject(((Level*)getParent())->getLevelSprite(), "200.Sprite"); // levelSprite 		lua_call(luaS->getLuaState(), 5, 0); 		luaS->clean(); 	}                          

Rather of a conclusion

The main goal of creating this game was rather "to do to make", so at that place is no first moment of success. Perhaps in the near future I will post its origin code for free access.
If it's interesting, in the following articles I'll talk about connecting AdMob and Google Analytics to a game written in Cocos2D-x.

DOWNLOAD HERE

GET Game Story / Sudo Null IT News FREE

Posted by: singletonworper58.blogspot.com

0 Response to "GET Game Story / Sudo Null IT News FREE"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel