The Daily Click ::. Forums ::. Klik Coding Help ::. Destroying Backdrops at runtime?
 

Post Reply  Post Oekaki 
 

Posted By Message

s-m-r

Slow-Motion Riot

Registered
  04/06/2006
Points
  1078

Candle
22nd November, 2012 at 22/11/2012 01:12:54 -

Imagine a bomb that explodes in a platform game. I would like to destroy each Background Object (all classified as Obstacles) that is overlapped by the "explosion cloud" graphic.

Is there a way for Backdrop Obstacle objects to be destroyed while in-game? Must they be created in runtime as well, like for example the application referencing an array or INI file or something like that?

There's a Frame-related Effect you can select that allows the deletion of Background objects at certain coordinates and/or on certain levels, but I've not yet been able to use it to do what I want done.

I'm toying with the idea of explosions being able to destroy floors and walls, but they are backdrop Obstacles, which - to my knowledge - aren't able to be destroyed. Any help in this area would be greatly appreciated. THANKS!

 
n/a

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1971

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
22nd November, 2012 at 22/11/2012 01:49:48 -

I would assume that you can only delete backdrop objects that were created at runtime, since that's what the action is called.
If you have backdrops that are created at edit-time (in the frame editor), you could easily replace them with actives, and then immediately add those as backdrops at the start of the frame, and destroy the actives.

Also if you add a backdrop (set to "not an obstacle") on top of an obstacle, it will overwrite the collision mask value - this is the easiest way to do destructible terrain like in "Worms" (see my shooting gallery example).

The problem is that you can only delete backdrops overlapping a specific point - you can't select an area. To do that, you'd probably need a fastloop to systematically pick multiple points within that area (it's easier if the game is tile-based).

 
n/a

s-m-r

Slow-Motion Riot

Registered
  04/06/2006
Points
  1078

Candle
22nd November, 2012 at 22/11/2012 13:13:03 -

Well...crap. I'll leave these kinds of explosions for the next project.

Thanks for the info, Sketchy.

 
n/a

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1971

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
22nd November, 2012 at 22/11/2012 14:20:31 -

I wouldn't necessarily give up on the idea, as it probably is do-able. If you get the rest of the map creation/loading system sorted first, and then get back to me with a file, I might be able to figure something out...

 
n/a

s-m-r

Slow-Motion Riot

Registered
  04/06/2006
Points
  1078

Candle
22nd November, 2012 at 22/11/2012 14:24:37 -

In this instance, all levels are crafted by hand in the SDK, not using some external file. It seems like an uphill battle to attempt refitting the level-generation system at this point.

I still have yet to learn how to use arrays and INI files for anything useful, so long story short it would take a longer time to simply learn the systems I'd be using than I want. I'd rather just finish the levels for this project, and use destructible blocks in a follow-up. For that project, I'll start at the outset with loading levels with external files.

 
n/a

lembi2001



Registered
  01/04/2005
Points
  608

VIP MemberIt's-a me, Mario!Wii OwnerI like Aliens!Has Donated, Thank You!PS3 OwnerI am an April Fool
22nd November, 2012 at 22/11/2012 19:01:59 -

This may be of some use to you or not, but i figured i'd try and help anyways.

The surface object allows you to load a picture in at runtime and then destroy parts of the image at runtime too.

If you are already handcrafting the levels you could use this in conjunction with the surface object.

For example:

You have all your background objects in place, set the surface object to the size of your level. In the event editor use the Start of Frame event to blit the background onto the surface.

You can now delete sections of the background using the surface object.

I can make you an example if you want.

EDIT:- I found a better example than the one i made:

http://andersriggelsen.dk/files/examples/terrain.mfa

Edited by lembi2001

 
n/a
   

Post Reply



 



Advertisement

Worth A Click