Moving box2d bodies randomly in entire screen - iphone

I want to fly b2bodies with in the entire screen randomly. Now I'm using ccMoveTo but it does not look soo good. Can anyone tell me if there is any easy method to move without using ccMoveTo or ccBazierTo?
The example game http://www.agame.com/game/chickaboom.html
Thanks in advance

You can use this code
body->setlinearvelocity(b2vec2(randomNumber1, randomNumber2));

Related

turn sprite list images into single images for use

so trying to make this as simple as I possibly can (which is next to impossible)
so in the unity editor using the 2d platformer learning thing im trying to switch the player sprites with many sprite lists from https://aamatniekss.itch.io/fantasy-knight-free-pixelart-animated-character for the images I'm trying to make the images into a new sprite animation
I hope I made this straight forward enough.
Use this BRACKEYS TUTORIAL
You need to make sprite sheets or create the animations in the Unity animation system and then trigger them by code or state machine.
https://www.youtube.com/watch?v=87cF8jqVpBA
i found it myself so anyone who needs to know here you go
make sure the sprite isnt in single but multiple.

Scrolling Scene Background - Unity

My title might have actually been a bit misworded, as to be honest I'm not sure how to word it, but basically I'm making a game on Unity and I have my main scene and I am making a main menu however what I want to do is have a, I guess, camera slowly panning around the main scene as the background of the main menu. Not sure if I worded that right or what wording to actually type into Google to research it so I'm hoping you guys might be able to point me in the right direction.
Cheers guys,
Jason
As stromdotcom mentioned you can attach a script to the camera.
It's hard to tell what you're trying to do but if you want to circle the camera around a point...
Try making an empty game object in the middle of your scene and point the camera at it.
Make the object the parent of the camera (using the object and cameras transform properties).
From here you should be able to set the game object to rotate using a script, which should make the camera spin as it is a child of the object.
I have not tried this in Unity but I have used this technique in other programs so I'm assuming it will work. Sorry if it doesn't.
If your scene is already set up then you can attach a script to your camera which simply modifies the camera's transform to move it around the room. You can move and rotate the camera just like any other transform in your scene.
Im pretty sure what you are looking for is "Animation view". Unity has a tutorial on it: https://unity3d.com/learn/tutorials/topics/animation/animation-view?playlist=17099

give item direction and speed from the way i swipe on the screen

I am working on a game in cocos2d. The game has multiple sprites coming on the screen. I would like to change that items direction ato the direction a swipe and the speed to how fast i swipe . Does anyone know how i can do this?
Kobold2D (improved Cocos2D) will have built-in gesture recognition starting with Preview 5.
UISwipeGestureRecognizers sort of do what you are asking, although you are limited on the directions you can use. If you want to implement any direction, simply make some code that figured out the direction and speed in the touchesMoved: method. This is a great tutorial on how to get the direction, and also has code which you can modify to get the speed. Simply get the distance and see how long it took to get there, and that gives you the speed. Hope that Helps!
If you want to do it without the gesture recognizer, here's a simple D.I.Y solution: http://www.cocos2d-iphone.org/forum/topic/7925

How to implement horizontal scrolling in box2d?

I'm working on an iPhone game using box2D and I need to implement horizontal scrolling... I was able to scroll the background textures and all... But, the problem is that, I'm not able to scroll the physics world of box2d... Please help me, how to move the box2d world... I'm not using cocos2d... I googled a lot, but was not able to find any solution without cocos2d...
Regards,
Suran
You should not move the world. Instead, try moving the "camera" (clip area) accordingly with the game character.
Try following: in touchesEnd Method:
[self.parent runAction:[CCMoveTo actionWithDuration:.5 position:ccp(yourPosition,0)]];

does anybody know slicing effect for iphone + cocos2d

in my game i want to give slicing effect , like after moving my finger on monster it should kill and monster blood should come on screen ,and disappear after few seconds ..
please help me ..
help will be appreciated ..
check this tutorial :- http://blog.roychowdhury.org/2010/11/19/cocos2d-iphone-tutorial-die-grossini-die-part-i/ they create blood particle effect manually
Take a look at MotionStreakTest example coming with cocos2d. I Think you can create your own effect based on this.
Or take a look at particle effects. Create a blood emitter and move it with your finger