I'm trying to add a SpriteSheet that is shown in the layer but not animated yet, I want to animate onClick.
The problem is when adding the sprite to the layer, the sprite is not shown if its not animated on start.
In Cocos2D-iphone I have not this problem.
Thanks in advance for any help provided.
Just have a look on the coocs2d-android master file :
cocos2d-master\cocos2d-android\src\org\cocos2d\tests\ActionTest.java
In this you can find the Animation class and compare your code with the test file...
or
write down your code ...
Alternatively, show a static image (first sprite) until user clicks, then load the sprites and start animation.
Related
I am trying to create a simple platformer game in C++ with SDL, although am having trouble implementing animated sprites into the game. Linked is my git repo.
As you will see i'm currently having difficult trying to draw a single portion of the sprite sheet as the player sprite and looping through it to animate it. At the moment the entire sprite sheet that contains the player sprites is being squished into a 32 pixel rectangle. I have looked into SDL_RenderCopy although changing the variables that I pass to the method has no affect.
https://github.com/mountainfolks/Platformer_SDL
Have you stepped through your code to see which draw call you're hitting? AnimatedSprite inherits from Sprite, but you don't have Draw set as virtual in the base class, so you're actually calling Sprite::Draw. That would explain the behavior that points to the source rectangle being null.
When the game over condition is satisfied I want to show a game over menu. This menu I have implemented via Scene. Now I wonder how I can show game over scene on top of ingame, without covering all the ingame scene. I want to make it look like a popup. How I should do that?
Checkout part "Design and Implement the Game Over Layer" in the following tutorial at: http://www.cocos2d-x.org/docs/tutorial/parkour-game-with-javascript/chapter9/en
It wrote in js, but i think the process with Cpp is the same.
I'd say just change your CCScene to CCLayer. Very few changes will be required in the code.
Then the part where you use the CCDirector to replace scene with your Game Over scene just initialize your Layer.
I'm wanting to create a WoW cooldown effect where a player does some action and is not able to do the action again until the sprite is fully shown again. I have a grayed out version of the same sprite and am wanting to slowly reveal the sprite until it is fully available again. So, there will be a slow blend vertically of the gray and colored sprite.
Is there a way to do this with built in functionality with Cocos2d and CCSprite?
I'm using v2 of Cocos2d so I could write a shader which I think would be pretty easy, but before I went this route I wanted to see if there is an easier way.
Take a look to the CCProgressTimer class. If I understand right, it will make what you want
You can use CCFadeIn to animate the colored sprite over the grayed sprite :
[coloredSprite runAction:[CCFadeIn actionWithDuration:1.0f];
I trying to make an empty CCSprite then I want to hand drawing on it using touch controls.
But, I don't have an idea how make it and don't know it's possible.
So, PLS help me or give me some advice.
Thanks
I wrote a demo program for CCRenderTexture which shows you how to draw sprites (or whatever you want) with touches:
Hi You can use CCRenderTexture example from Cocos2d for drawing..
Check out this link http://www.cocos2d-iphone.org/forum/topic/8474
I want to animate the way a CCSprite appear on screen.
At the moment I'm using "addChild" to display the sprite on screen but I want it to appear on screen with animation.
Is is possible?
Thanks
Try reading through the Cocos2D programming guide, there is a subject on animation with source code there. http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:index.