Tag Info

Hot answers tagged

10

I found the implementation description from the author of this effect: It surely was a lot of work to create the depth illusion in a 2D plane. The principle is very easy though: circles start in the middle of the screen with scale 0. Then the first circle of the tunnel starts scaling proportionally to the time elapsed (linear scaling doesn't work) ...


7

Sprite animation is pretty simple. You just create a CCAnimation node, add the images to loop, then create an action using CCAnimate::actionWithDuration(float,CCAnimation,bool) and make the sprite run it. Code snippet: CCAnimation * anim = CCAnimation::animation(); // There are other several ways of storing + adding frames, // this is the most basic using ...


5

You can use CCTMXTiledMap: http://www.cocos2d-x.org/reference/native-cpp/da/d68/classcocos2d_1_1_c_c_t_m_x_tiled_map.html It supports isometric, hexagonal and orthogonal tiles.


5

In new version of CoCos2dx (2.1.1) you can use (it's working) CCSpriteFrameCache* cache = CCSpriteFrameCache::sharedSpriteFrameCache(); cache->addSpriteFramesWithFile("numbers.plist","numbers.png"); CCSprite* sprite = CCSprite::createWithSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("slice2_0_0.png")); ...


4

It really depends on your art style. Does the game look fine scaled down halfway? Would making new, lower-res artwork push you over the current OTA download size? If so, then keep the larger graphics. There are not a lot of people with 3GSs and 3rd gen iPod touches out there (the only currently supported non-retina small devices), and with iOS 6 the 3rd ...


4

My second question is that my actual game scene uses bound camera and I perform scrolling on that camera but my other scene uses the normal camera. So in this situation what to do? how to use multiple camera for single engine? or how to reset available current camera? Our 3d game engine allows us to create as many render targets we wish. A render ...


4

You are probably updating the velocity twice, since this is usually done in the integration step itself. I expect you implemented the RK4 integration from http://gafferongames.com/game-physics/integration-basics/. The author defines Derivative.dv as the acceleration (derivative of velocity) and State.v as as the velocity In the evaluate function you can ...


3

You could create a Bézier curve that matches a sine (read this article for an example). Creating a Bézier curve from a sine, just to feed into CCBezierTo seems like a very counter-intuitive way of doing things though. I would skip CCBezierTo entirely and update the position of your sprite yourself. You could do so in your update method or implement a ...


3

You need to ask for the device's resolution, and then, set the viewport to fit it. I assume that you are using Cocos2d X, they call it Multi Resolution, hope this helps. Edit: This post from Jesús bosch may give extra information about the topic.


3

You could use something that someone has already created. http://ak.net84.net/iphone/creating-a-repeating-backgroundinfinite-parallax-effect-in-cocos2d/ It looks like the developer who wrote that ran into some troubles using the out of the box object as well and as such he decided to write a custom solution and subsequently share it with the world! Good ...


3

Your actual view of the ball or playing field shouldn't really matter in this. First of all, you'd mostly want a constant/fixed horizontal velocity for the ball. You can add air resistance to this, but it wouldn't really change anything, as you'll just have to add it to the equation. Ignore the actual height of the shot for now. Having a target distance as ...


3

Without ever having implemented this... First you will have to control every step of the new gems on their way to their final place. Or in other words, move your sprites only on field on your grid and then calculate their next field. Now generate new gems and drop them into that column. On each step you check if the gem can fall further down. If not check ...


2

You need to add CocosDenshion, which is the audio library. Be sure the link is done correctly or copypaste it into your folder and use <> import just in case #include <SimpleAudioEngine.h> Once you have it correctly linked the functions used are quite trivial: CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect("stuff.wav"); Be ...


2

The steps are as follows: Generate the project for Android using cocos2d-x template Add project to NVPack's Eclipse Fix make files, IDE configuration and whatnots Compile the libraries with Cygwin and build_native.sh script, they will be automatically added to the obj folder of the project Execute/debug like an Android application Those are the windows ...


2

you can't set a callback function for CCLabelTTF or any other Label class, yet there is CCMenuItemLabel you can use. you first need to create an instance of CCMenu class. then you need to allocate CCMenuItemLabel instance, using CCMenuItem::initWithLabel (CCNode *label, CCObject *target, SEL_MenuHandler selector). just check how helloworld sample handled ...


2

I think you've got the right idea, but the execution is going to be immensely challenging. I'm presuming when you say 'in an SVG file' you mean that the shape is defined by one (or more — your sample figure has an internal hole!) stroke paths. Unfortunately, SVG paths can be remarkably complicated, with both quadratic and cubic Bezier curves and ...


2

It's called 2D skeletal animation. Essentially you're animating a skeleton that has sprites for the body parts placed on top of it. This allows you to reuse animations for different characters and characters can have multiple sets of armor, weapons, etc. There are a number of questions on the site already about it: Tools for 2D skeletal animation How ...


2

I have this code working in cocos2dx 2.0.3, also make sure that you've added the plist and png file to your project, sometimes visual studio can be a bit funny about resources. CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("AnimBear.plist" ); CCSpriteBatchNode *spreetsheet = CCSpriteBatchNode::create("AnimBear.png"); ...


2

I found out the problem! :) In "credits.js" you need to change: onEnter:function() { }, onExit: function() { }, to onEnter:function() { this._super(); }, onExit: function() { this._super(); }, Hope this works for you! -Edit- The reason actions were not running is because 1) the engine was not being notified of any of the objects ...


2

It depends what you mean by tile-based. Most 2D games that involve a level that you view from the top-down are tile based. In this way different tiles usually have different properties, and pathfinding such as A* is easy to implement. A lot of level editors use a tile-based sprite-sheet to define all of the aspects of a level, but then use them in a tiled ...


2

Gordonk was absolutely spot on. It now appears that I have silky smooth movement at 60fps. If I cap the frame rate at anything less than 60 I start to see serious stuttering, but I guess that's a separate issue to explore. So here is the code I am using right now. It hasn't been optimized in any way, it was just to implement a fixed time step. I'm using the ...


2

I'll share my design as of current implementation I did for my game. ObjectPool & Managers For objects whether it's enemy objects, collectable items, powers-up, effect (more like particle), etc, I managed them through my own implementation of ObjectPool as you will know roughly number of instances you would need in the game for certain time, so it will ...


2

Lua is a pretty well developed scripting engine that is flexible and easy to integrate to your games, and is already supported in many game engines, for instance: 2D Agen (Lua; Windows) Blitwizard (Lua; Windows, Linux, Mac) Corona (Lua; Windows, Mac; iOS/Android) EGSL (Pascal/Lua; Windows, Linux, Mac, Haiku) Grail Adventure Game Engine (C++/Lua; Windows, ...


2

Try this: CCSize winSize = CCDirector::sharedDirector()->getWinSize(); CCSprite* test = CCSprite::create("Ball.png", CCRectMake(0, 0, 80, 80) ); test->setPosition( ccp(winSize.width * 0.5, winSize.height * 0.5) ); this->addChild(test); It works for me. also try using this sizes: CCSize visibleSize = ...


2

You should retain each animation created in the last line of HelloWorld::createAnimation(). something like _charanimation[a]->retain(). And later when this class is getting destroyed (in HelloWorld::~HelloWorld() or whenever you don't need animations any more) you should release all those classes you retained the animations to mark they are not needed ...


2

I'll answer my question, but @akg is the answer that guided me. I've made the code in cocos2d-x, and I didn't used boundingBox() method. Hope this helps someone, :) I didn't found something like this in other site, so I hope not be doing something wrong... bool SceneGame::ccTouchBegan(CCTouch* touch, CCEvent* event) { CCPoint touchPoint = ...


2

First of all, I need to notify you that my answer needs a slight modification to your approach in RunAnimation() to be able to let this answer works. Personally I don't recommend you to use that version of RunAnimation() function as it always executes the code with CCRepeatForever manner. My answer here can be applied with your case with a slight ...


2

The 2D coordinate system that describes your field can be parameterized the same way as your trapezoid. Think about it this way... First let's label the corners of the field in the unprojected space: TR: top-right BR: bottom-right TL: top-left BL: bottom-left Each of these corners has an x and y value, with BL== (0, 0) most likely. A good sanity check ...


2

Implement your own Point class. That's good design if UI Point is seperate from logic Point. //Point.h class Point { public: int x,y; }; Point different to cocos2d::Point. In Projectile class, you include and use it. //Projectile.h #include "Point.h" class Projectile { public: char* image; Point* position; }; Then render class, include the ...


2

ngoaho91 is basically hinting in the right direction but is not spelling it out explicitly, so I will try to make it more explicit. So you took the framework and started implementing the logic within the separate framework classes. The problem why you can't simply test the game logic in isolation, is because it is not isolated. You write that you ...



Only top voted, non community-wiki answers of a minimum length are eligible