Can Sprite and Box2d coexist and collide?

I’m considering having some “regular” Sprites and some Sprites that are using Box2d physics. Before I go down this road too far, I want to make sure it is possible to do and make sure elements created with each will properly indicate collisions.

Does anyone know how or if I can do such a thing?

The reason is that I am still stuck just trying to send a sprite down a flat platform with Box2d, such that it just moves along the platform. I can’t figure out how to do it. I can’t figure out how to set up the physics on the platform and the sprite such that it works as expected. So, I’m going to try to just send it along with Cocos2d’s MoveTo and MoveBy and then use Box2d for flying objects that aren’t bound to a platform.

I don’t know how else to proceed at this point.

Have you tried our built in physics engine?

Also cpp-tests has working examples.

What you want to do is 100% doable as many games function this way.

I’m definitely open to using the built in engine. I’m so early in the process that doing that wouldn’t be a problem.

In the cpp-tests, I can’t find where in the code the platform is being built. (I assume the project to look at is ChipmunkTest, but I don’t get where the platform and sprite are made).

try PhysicsTest.cpp and look at the One Way platform test.

cpp-tests is a good way to see working code, but don’t try and code your game the same way in terms of class layout, etc. I don’t consider cpp-tests the best way to learn coding semantics. The concepts on how to use each piece of functionality is solid though.

I would highly recommend not doing what you propose!
Instead, get the physics engine of your choice working, be that Box2d or the built in engine.
It is more complicated than just telling an object to move - you need to apply a force or an impulse to the object, in the direction you want it to move.

My go-to place for all things box2d is

http://www.iforce2d.net/b2dtut/

Use box2d to model your game, then essentially position sprites where the box2d objects are, mapped to the screen.

I think using the built in physics is easier, but I personally prefer box2d…