Im trying to come up with a good way to animate large level elements in flashpunk, like a waterfall, or a river and pond, or the glow of a distant fire. Things that aren’t exactly entities, but are part of the background itself
[SOLVED] Animating background(running water effects)
NotARaptor
(JP Mortiboys)
#2
As luck would have it, FP has just the function for you - a way to add a graphic element to a world without having to declare an Entity - useful in cases like this where you don’t need logic like collision, AI or anything else entity-ish.
That function is… world.addGraphic()
It does create an entity behind the scenes, but it’s a straight Entity
instance; you don’t have to create a subclass. It takes the graphic (duh!), entity coordinates and layer as parameters - and for usages like yours it’s pretty much fire-and-forget. It does return the created Entity
though, should you really need it.