I Wanna Community

Seamless blocks

0 Members and 1 Guest are viewing this topic.

Offline WetWookie

  • 90
  • OS:
  • Windows 10 Windows 10
  • Browser:
  • Firefox 51.0 Firefox 51.0
  • Playstyle: Keyboard
Seamless blocks
« on: February 08, 2017, 01:41:30 PM »

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

« Last Edit: March 10, 2017, 11:46:06 AM by WetWookie »

Offline AlextheTroller

  • 9
  • I'm an artist and programmer... yeah.
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Chrome 56.0.2924.87 Chrome 56.0.2924.87
  • Playstyle: Keyboard
Re: Seemless blocks
« Reply #1 on: February 08, 2017, 02:07:30 PM »

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

Would definitely recommend!  -Alex
Doing art and programming as of now and playing fangames from time to time. If you ever need me for sprites or something else send me a discord pm in the I Wanna official discord channel.  Also sup.

Offline kurath

  • 3
  • OS:
  • Windows 10 Windows 10
  • Browser:
  • Chrome 62.0.3202.94 Chrome 62.0.3202.94
  • Playstyle: Keyboard
Re: Seamless blocks
« Reply #2 on: November 28, 2017, 11:53:29 AM »
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