spawning random actors

General discussion about Box2D tutorials
Post Reply
Phantom Ppepper
Posts: 22
Joined: Tue Sep 10, 2013 3:59 am

spawning random actors

Post by Phantom Ppepper »

Hey iforce2d,

I've been beating my head on the desk for several hours now trying to figure out how to spawn actors to my box2d world (created with RUBE, of course).

I'm trying to make something similar to the classic "Astroides" game
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: spawning random actors

Post by iforce2d »

What is the question? To give us something to work with, you really need to say:
- what you want to do (check)
- what you've tried so far
- what went wrong
Without this information people might write a post suggesting to try something you've already tried, which wastes their time and yours.

Often the operating system, programming language and SDK/framework can be relevant too, so it wouldn't hurt to mention what environment you're dealing with. Some further definition of what you mean by 'actor' would be helpful too.
Phantom Ppepper
Posts: 22
Joined: Tue Sep 10, 2013 3:59 am

Re: spawning random actors

Post by Phantom Ppepper »

Oh, sorry for the vagueness - :oops:



After several concussions, I am close to scrapping the idea all together. The thought was to create a scene where rocks would generate "spawn" just to the right of the screen and disappear once off the screen after making contact with a sensor, for memory conservation.
Screen Shot 2013-10-18 at 9.04.48 PM.png
Screen Shot 2013-10-18 at 9.04.48 PM.png (25.21 KiB) Viewed 13281 times
The player is on a prismatic joint that moves on the Y axis via accelerometer, and the sole purpose of the game is to avoid the rocks for as long as possible, which are kinematic bodies traveling at a constant speed linearVelocity(-5,0).

But I believe using RUBE to create actual LEVELS that progressively get harder instead might be quite easier to develop and more fun for the end-user in the end.

-using RUBE and Cocos2D Loader with recent updates
-Cocos2d/Box2D for iOS Development via XCODE, latest versions

Thanks for your time and work.
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: spawning random actors

Post by iforce2d »

Obviously RUBE is not able to make an endless scene, but what you could do is make sections of level, and load those sections in dynamically as the view scrolled along. Or, if the levels do actually reach a conclusion/goal every now and then, you could set up the whole level from those sections just once at the beginning. Another option might be to take sections as they go off the screen, and move them to the front of the river again. In any of these cases, the sections would have to be made so that they line up at the edges correctly.

This is not really the strong point of a scene editor though, as 'level editor' and 'endless level' don't go together too well :D It really depends on your program to do something clever after loading.
Phantom Ppepper
Posts: 22
Joined: Tue Sep 10, 2013 3:59 am

Re: spawning random actors

Post by Phantom Ppepper »

Ah, I see. Thanks!
Post Reply