To use FP.world.create you need to provide the class type that you want to create:
(FP.world.create(Bullet) as Bullet).setup(x + 30, y + 19, 7, 0);
Be careful with blanket-converting a whole project to recycle/create! Thar be dragons! Basically, you’ll need to use setup(args)
functions or the added()
function in all of your objects instead of constructors for most stuff, but make sure constructors are used for all memory allocations. I made a post about this recently here. Also you have to be sure that all of your objects variables are being reset in that added()
or setup(args)
function; if not you’ll get subtle and difficult to debug issues from objects not resetting their variables when spawned. This can cause all kinds of crazy and unpredictable behaviour ranging from exceptions to collision bugs, logic bugs, physics bugs… pretty much anything. So make damn sure you’ve got that solid!