Feb 4, 2013

The meat you find inside breakable walls may very well be my own brain matter.

Alright. So breakable walls took me less than a day to code in my alpha engine, and that thing used a complex script to destroy an object and then replace it with two or more objects. It worked. Quite well in fact.

So one would think they'd be just as simple in the original code. Fuck no. God forbid breakable walls actually be legitimate objects that have the same features as other objects. Oh sure, they have an x and a y. They even have a sprite and a state. Oh but wait, it's not the sprite of a wall, it's the sprite of what they drop.

That's right, breakable walls don't actually drop anything. They turn into what they were supposed to be dropping. There is no "wall object event" so to speak. Every step when the game phase is #$03, the game checks if walls are breakable (once you break a wall, it can't be broken again by revisiting the room) and then checks if they actually have sprites. If it does have a sprite, that means it was already broken and "dropped" something. Well, the code is basically the code for picking up said drop.

The code is basically something like:

if drop==n && place_meeting(x,y,Trevor) play_sound(snd_getMeat)

Yup, does that same code for every "drop". And there are surprisingly quite a few variables that go into each block.

No comments:

Post a Comment

©TheouAegis Productions™. Powered by Blogger.