@implementation Level
@synthesize doors, rooms;
- (id) init
{
self = [super init];
if (self != nil) {
rooms = [[NSMutableArray alloc] init];
doors = [[NSMutableArray alloc] init];
}
return self;
}
- (void)generate{
int room_count = 2;
Room *room;
for (int i=0; i<room_count; i++) {
room = [[Room al...
I have 4 images and a background. I already about to animate the image to move accordingly. But the back ground is not moving. I am not sure how to make the background move accordingly to the movement of the images. Because each of the images moves differently.
this is first image move:
- (void)loadIllustration1
{
Sprite *illustra...
i have new prob when i load application on device first time game is slow and second time when i start new game without closing application it is faster. now its nothing to do with sound coz having same problem with sound off s well. i think its related to sprite. can anyone help i have no time for research
...
I am developing some games using multi touch for iPhone (cocos). Could anyone teach me how to start, from very scratch beginning. I am not sure where to start or any resources that can help. I really appreciate the helps.
@implementation GameScene
- (id)init
{
if (self = [super init])
{
Sprite *background = [Sprite spriteW...
I am trying to preload a bunch of background music files. Basically i am calling preloadBackgroundMusic several times. This breaks on me when i try it with SimpleAudioEngine :
[[SimpleAudioEngine sharedEngine] preloadBackgroundMusic:@"vitesse1.mp3"]; [[SimpleAudioEngine sharedEngine] preloadBackgroundMusic:@"vitesse1.mp3"];
but when I...
Hi all,
How can I change an image position in cocos2d like background-position in css? By position I don't mean the position of background like ccp(200,150), I mean for example, I have an image with resolution of (1000,200) that contains 5 (200,200) images. I show this image in (200,200) sprite and I want to change the image position so...
Hi all,
I am using AtlasSpriteManager and AltasSprite to create frame by fram animation with 1 one file. I wanna write something that at first show a simple picture, without any animation and for example when I touch it, it shows some animation and return to the first position and frame. I just can't show the first frame without animatio...
Hi,everyone, I made a shooting game just like 1942(classic shooting game),but here's the question, FPS drops to 5~6 when the fighter shoot out a straight line of bullet,about 7~8 bullets in the screen,Actually, only 8 bullets of player will appear in games, when bullets fly out of the screen they would reset to the fighter's center and b...
hello,
i started out learning cocos2d and came across these lines of code:
-(id)init {
self=[super init];
if(self!=nil) {
Sprite *bg = [Sprite spriteWithFile:@"menu.png"];
[bg setPosition:ccp(240,160)];
[self addChild:bg z:0];
[self addChild:[MenuLayer node] z:1];
}
return self;
}
I ran the same lines of code with the followin...
Hi everyone
How can I apply a timer count down in Cocos2D and the score counter that both will be display on the screen?
I am still new to this
Please help me out
Thanks a lot
...
I am detecin a memory leak particularily in the startAnimation method in the director object.
- (void) startAnimation
{
if ( gettimeofday( &lastUpdate, NULL) != 0 ) {
CCLOG(@"cocos2d: DisplayLinkDirector: Error on gettimeofday");
}
// approximate frame rate
// assumes device refreshes at 60 fps
int frameInterva...
Hi all,
I run my program using Object Allocations Performance Tool. My program is a really simple program which has a simple AtlasSprite object. Just it ! but I wached the allocations and it's allocations is always increasing in spite of doing nothing ! any idea !?
...
http://www.youtube.com/watch?v=DyssOSmwuoo
according to my video
when call animation PageTransitionForward it will have a triangle on the left
and that triangle can see through next layer
how can i fix it?
...
I need make active background which consists of 2 CCSprites which moves successive. But at the same time between CCSprites appear a little interval. How fix it?
Some init code:
sprite1 = [sprites objectAtIndex:0];
[sprite2 setPosition:ccp(240.0,self.position.y)];
sprite2 = [sprites objectAtIndex:1];
[sprite2 setPosition...
To cut a long story short, my project (an iPhone app) was all working fine until I started using a C++ sdk (openfeint). Everything was working fine, including the C+++ Openfeint stuff, until I switched from tesitng on the device to testing in the simulator.
Now it won't compile for anything and I'm getting just under 200 errors. It's a...
Hi everyone, I am developing game for iPhone using Cocos2d, the problem I am having now is the game crashes when it actually runs on the iPhone, but on the simulator is fine. Maybe the game has consume so much memory. Hmm I am thinking that maybe I create so many objects. Such as when the user play, if he makes mistakes, the game display...
I am trying to place a series of sprites on a layer, but since I want to move all of the sprites as a group, I have created a CocosNode, set it to the same size as the screen and position it in the center of the screen, then add the Sprites to that node (lightNode) instead of adding them to the layer.
What I am seeing is that the sprit...
How can I create a registration form on Iphone so that if I submit the form the data must be store on my database which is on my webserver?
...
I am trying to play a .gif animation in cocos2D. For this i am using the library glgif. Now, to display the animation i am pausing the Director, adding a subview to show the animation and after the animation is done i am resuming the Director.
However, I am not able to resume the state of the Director and it shows blank.
So I tried this ...
I'm using Box2D on my iPhone app using Cocos2D.
I'm using mouse joint to drag objects by touch.
The touch event is handled to find the corresponding Box2D body using AABB queries.
I would want to extend the area of Box2D bodies. In this way, I can touch approximately my body and still respond.
Does it exist any way to do this? Thanks...