I have question about Particles in cocos2d. How can I move particles without moving particle emitter. I want to have such move like in doodle jump(snowing map).I set position type to kCCPositionTypeGrouped and move my particles in this way:
CCAction *movePlankton = [CCMoveTo actionWithDuration:0.6f position:CGPointMake(planktonEmitter.position.x, planktonEmitter.position.y+distanceToMove)];
[planktonEmitter runAction:movePlankton];
But this move particle emitter too, and after few moves on my screen i haven't any particles.
Can somebody help me with this?
Thanks.
You can only move the emitter. The movement of the particles is an essential aspect of the particle effect itself.
What you can do is:
use multiple particle emitters, each being responsible for a small aspect of the overall effect
use sprites for controlled movement
Related
I am moving my sprite using CCBezierTo:
id streakAcross = [CCBezierTo actionWithDuration:myDuration bezier:bezier];
I would like to modulate (sinusoidal?) the sprite along the path or rather introduce a smooth wobble that moves the sprite along either side of the bezier path. I think I can spawn a ccmoveby action simultaneously, but have not gotten my head around it.
I have solved this by embedding the sprite inside a ccnode. The sprite is animated up and down (forever) using CCMoveBy-s relative to it's parent. Then I animate the parent node along the bezier path. I added an ease out action to smooth things out.
Is it possible to simulate a candle for instance in cocos2d. So the scene will be black and then when the candle appears it will lighten up the room in a realistic way.
If possible, how would I achieve that effect? Any redirections, guidance is welcome.
Thanks.
Please note, that I don't want light reflection algorithms, as this is only for simple use. I just need it for a game where the players life is the abillity to see the room.
You should check out raycasting. If you set up Cocos2d to use Box2d, you can use Box2d's raycasting method to achieve this effect. You can make the walls in your room box2d rigid-bodies, and then raycast from your candle origin to a number of points on a circle around it. If the raycast intersects a wall, mark the location of the intersection. Then at the end you can fill in the area with light that is inside a polygon created by all of the raycast intersection points.
I am having an circle in the center of the world. I add some balls to the world in the form of b2Body. Now i want to move or throw the ball to the center of the screen. The effect should be like the balls are colliding with the circle.
The ball are positions randomly, so they can be at any were on the screen and the need to travel to center of the screen to the circle
Can any one tell me how to do this because i have no idea to move the b2Body object.
I want blue circle to attract red circles. Or in other words i want red circles to move to blue circle.
Finally got the solution of my problem. I use the concept of radial gravity.
http://www.vellios.com/2010/06/06/box2d-and-radial-gravity-code/
In this case, I am not sure about this way but you can try this way. I guess you are adding b2body by touching on the screen. Now i don't know what is the type of your B2body.
There are two ways to move the b2body.
check this link:http://www.cocos2d-iphone.org/forum/topic/21620
From this link,
I am guessing, in your game ,body is b2static body,What you can do is Move your sprite to center of the screen, with respect to that change the position of the corresponding body in tick method.
And you need to stop moving the sprite when it hits the center ball so stop moving corresponding sprite when it hits the center ball.
This may be the possible way if i understood your question.
In a game I am programming in Cocos2D and Box2D, I have a sprite that is in the shape of a hill, and I am trying to attach a body to it so it can respond to physics. My idea is to use a rotated rectangle shape so that it aligns with the slope, but I need to be able to move the sprite so that the body stays appropriately lined up. I can make the body and sprite work together in the case of a circle, but I can't figure out how to make it work for the case of the rotated rectangle. Could someone explain the code to do this?
Yes I agree to user1634707. CocosBuilder will be one potential choice.
I have attached a camera object to a mobile object (a car) at a scene. The camera shows the area which the object is at and looking to (front window of the car).
My problem is that, while my object (with camera) moves or rotates, the objects at the screen (street light sticks, other cars moving parallel) seem shaking. Namely I see the solid object and some little transparent versions of the same object near to the original. It is more observable when the camera changes its orientation than when it moves straight. When moving straight, the lights shake when they are far from the observer, at some range they stop shaking, and when they get nearer they start shaking again.
I do not think that OpenGL makes a motion blur at the background by itself. But I also could not find a name to this problem, so I am not able to find a starting point.
When the program is in full screen mode, and the time required to draw the full scene is below 16msec (for 60fps), then I could be able to have smooth movement with no objects oscillating.
When the draw time oscillates too much or when I set Vega to limit the fps algorithmically, the scene oscillates.
When I set the swap interval to 1, namely letting the underlying draw thread to match with screen refresh, then it is fine again.