I have scenario in which I need to understand where should I use scene and where should I use layer.
Scenario
water is moving and fish is floating there some objects are coming fish needs to kill them by throughing any object.fish is also animated?
please help
where should I use scene and layer and how?
simple
if u have dependent between layers
then add them in same(one) Scene
otherwise just use different scene
Example
water fish object are dependent between them
like
water will flow continiously in background
fish will swim in it
object also floating in it
so
water has fish
water has object
moreover
if the object collide with fish then
fish should be killed.
so fish and object are dependent.
so create three layers for water,fish,object
each layer will handle its seperate touch events
by
layer.isTouchEnabled=YES;
one thing while arrangement of adding layer is important
inside water the fish can be live . so it has to inside
so
first add fish then object then ur water
water layer should be faded and transparent
so look like ur fish and object are inside water.
now one bug is while touching the fish not affect the fish .why?
bcause water is added last . so inside of water touch began method u should really handle the fish layer.
Related
i'm trying to compose a dataset for the detection of soccer players, ball etc.. in a soccer game, i'm using alexeyAB Darknet framework,
So in the labeling phase in each image there are at least 8 players a ball and other stuff, at some point it is logical to think about the fact that i will have enough instances per player, but not enough for the ball and the goalkeeper for example,
so can i only marking bounded boxes the ball and other things avoiding to do it with the players to not waste time?
If you are training the model on your own dataset, I would recommend limiting the number of labels/classes in your data to what you seek. For example if you only want your model to see balls, goal-posts and Not players, simply keep the classes as balls and goal-posts. (This reminds me of a classification problem where 0 stands for balls and 1 stands for goal-post). P.S you mentioned object detection and Not Localization, which is the purpose of the YOLO models.
I have a code that changes the position of an object when grabbed to 100 units in front of the camera, this allows the player to stand on top of an object and pick it up causing him to fly towards wherever the camera is pointing.
Example: In this picture, I stood on top of a movable red rock. While on top I picked it up and moved my camera upwards which caused the rock to move to that position while carrying the actor. Because of this, I can quickly move to anywhere on the map by standing on top of an object and picking it up.
The skeletal mesh is unrelated to the grab function and the range of the grab is set to keep movable objects close to the skeletal mesh (like lifting this pebble) if that helps.
Any suggestions on how to fix this issue? Thanks in advance!
Assuming that your objects have some sort of toggle-able state that determines whether they can be picked up or not. One solution to the problem you are facing would be to cast a ray from the bottom of the player and if that ray hits an object that can be picked up, temporarily disable the ability to pick the object up. This introduces a new problem of stacking up two objects and moving the bottom object however. Alternatively you could also change objects so that when you are holding them, the collider is disabled on the object. There are many more ways you could go about solving this issue, but without knowing in detail what you are trying to accomplish by holding objects, it would be hard for anyone but yourself to choose the appropriate solution.
I have seen this before, and making my research i've discovered that if you create allot of circles objects in box2d, then apply a color, then blur it and at the end sharp it a little bit ( same stile like "Where is my water" game created by disney ).
But of course in a game like limbo, with a huge world this is extremely expensive.
Since i have seen this in a few games over the internet i still trying to understand how can i build this with box2d ? ( the games over the internet where/are created with in flash, and i want to do it in cocos2d for the iOS platform )
a few examples about how the water works, for those that didn't played the Limbo game:
1.A box will flow on the water, the box will enter in the water only half of it and half of the box will will remain above the water. If an object (like: the player ) will falls above it the box will have the end of the titanic, it will sink.
2.A rock will sink.
3.The player, well i guess here will be different choices.
4.A boat, for the bout i know a bool should do the trick BOOL canSink; but again how should i make that water effect ? balancing the object on it, an bouncing if the object falls in the water, and for sinking a slower velocity ?
It may look like allot of questions,but at the end is only the " How to create the water effect in box2d?"
I guess you're looking for buoyancy effects, here you have a couple of interesting resources.-
http://www.iforce2d.net/b2dtut/buoyancy
http://personal.boristhebrave.com/project/b2buoyancycontroller/demo
As for the water waves effect, you can take a look at.-
http://www.sideroller.com/wck/?f=6
http://www.cocos2d-iphone.org/forum/topic/25494
Hope it helps.
Im using Level Helper and SpriteHelper to create my sprites, images, levels and more importantly animations and physics.
Note, by physics i mean the debugdraw you can see on the simulator that is used for collision detection.
I created a swimmer and added physics to this. Done the code so the physics follows the swimmer around the pool as they move. I have now come to animate the swimmer, make the legs kick etc. Now when i load my game and only the first sprite of the animation is the outline for the physics. So i can see the legs kicking on the swimmer but the debugdraw mesh of the physics doesn't animate as well. Now this is not really a problem until for example my swimmer loses their legs (weird game i know). I change the animation to now a swimmer with no legs but again the physics mesh still shows the legs. So any collisions with stuff still happens where the legs were but they shouldnt. This make sense?
Is there a way to update the physics on the new animation or do i need to remove my whole swimmer and draw a new one?
Any help at all would be great. Thanks
This makes sense, since your sprite uses the same box2d mesh in both states. If you want to have a different collision behavior after altering your Sprite, you should assign another (smaller) mesh body.
Note that even in cocos2d side, your sprite still has the same container box with the new animation.
In order to keep using the SpriteHelper functionality you might want to create 2 different sprite-body sets: one with the full body, then after the "accident" replace it with the legless sprite.
Now, gameplay-wise, my opinion is that there shouldn't be any collision for the legs anyway. since they are moving, players will not find it weird to have them not colliding. You could use a mesh body with no legs and use it for both sprites. Except if you want to have different collisions as a gameplay feature (Like giving the player the choice to cut his legs in order to fit in a smaller cave etc)
I have been experimenting with the box2D sample project within cocos2D for the iPhone and am wondering if box2D is the appropriate engine to use to make a moving object "stick" to a stationary object when the moving object is finished moving in a certain direction.
Here is a simplification of what I am trying to achieve: I have MovingObject, a dynamic rigid body, that moves vertically against gravity when enough force is applied to it. As MovingObject moves, it may overlap a static object, StationaryObject. When gravity diminishes MovingObject's velocity to zero such that it is no longer moving, I would like to have MovingObject remain where it is ONLY if it overlaps StationaryObject. If the object's do not overlap, MovingObject should start to move back down towards the ground per the force of gravity. During that descent, if MovingObject at any time overlaps StationaryObject, it should stop its descent and remain in that location as if it is stuck on StationaryObject.
I am able to get MovingObject to move per the forces I am applying to it, but not really sure how to make it stop and stay there once it reaches the top of its ascent, assuming it is overlapping StationaryObject.
Currently, I am experimenting with simple square/box objects but eventually both MovingObject StationaryObject will be defined as very different complex polygon shapes.
Thanks in advance for any insights and/or suggestions for achieving this.
Sounds like you'll want to change the type of fixture used for "MovingObject" while it "ascending" and then change it when it is "descending" so that it reacts differently (to overlaps).
by "overlap" it sounds like you want to achieve something similar to "one sided platforms" in a platform game (ie; Mario Bros.) - I would recommend looking into the solutions for one-sided platforms for starters.