Fangames > Game Design

Seamless blocks

(1/1)

WetWookie:



Object Code

Create the above object, give it a sprite of the texture you want and stick it off screen on the room you want skinned. I use textures twice as big as the room and scale it at runtime so it looks nice in full screen. Play around with the scaling in the create event if you're going to use a different size texture. There's also code in the create event to skin your spikes. You can remove it if you want or if you decide to keep it in your sprite image should be a 4 frame animation in order Spike Up, Spike Right, Spike Down, Spike Left.

Notes and limitations...
As the object is coded now it creates the surface once and redraws it so if you have moving blocks you'll need to modify it to draw up the surface every time.
The object assumes that blocks will be placed on a 16 (or 32) pixel grid placing adjacent blocks offset by something else, like 8 pixels, will result in the outline being weird.
Also, gamemaker has rounding errors if you resize blocks more than once so if your outline sticks out into empty space it means the block has a resizing error and should be deleted and replaced or resized back down to 32x32 and then resized

AlextheTroller:


Works like a charm, easy to implement code and really neat for making quick and gorgeous levels!.

Would definitely recommend!  -Alex

kurath:
This is a really awesome function that I wanted to adapt for my own project. In doing so I wanted to make it draw out the inner corners and add a little more flexibility. My code's a little messy since rather than going from scratch to make the functions as clean as they could be I just retro-fit them into wookies, but hopefully shouldn't be a problem.

Additional to drawing in the inside corners, it also adds three variables which you'll need to initialize somewhere pre-draw for additional functionality. If you want to maintain wookie's standards, alpha would be 1, color would be c_dkgray and thickness is 1 which you can just place in the create function and adjust via creation code (or however) on an individual basis. Keep in mind that as with the normal setup, you'll need to free the surface if you want it to redraw after changing any of these values.

alpha -> simply affects the output opacity of the drawn surface, in case you want the seamless blocks to be semitransparent.
color -> lets you adjust the coloring of the block borders
thickness -> lets you adjust the thickness of the block borders

Should hopefully be able to just drop this into the draw code instead:

Updated Code

Navigation

[0] Message Index

Go to full version