Log In  
Follow
Makke

I wanted to achieve this effect with fill patterns for a recent project I started so I figured I'd share it here incase anyone else is interested in using it.

The local fill pattern function is shifting each row/column in the fill pattern by given x and y amount. It's using binary arithmetics and a cache of shift masks.

Here's the original code for version 1.0, takes 126 tokens:
[hidden]

--turns a screen-space fill pattern, into an object-space fill pattern by wrapping the patterns row and column by the given x and y amount.
function get_local_fill_pattern(x,y,fill_pattern)
	local add_bits=band(fill_pattern,0x0000.FFFF)
	fill_pattern=band(fill_pattern,0xFFFF)
	y=flr(y)%4
	if(y~=0)then
		local r_masks={0xFFF0,0xFF00,0xF000}
		local l_masks={0x000F,0x00FF,0x0FFF}
		fill_pattern=bxor(lshr(band(fill_pattern,r_masks[y]),y*4),shl(band(fill_pattern,l_masks[y]),(4-y)*4))
	end

	x=flr(x)%4
	if(x~=0)then
		local r_masks={0xEEEE,0xCCCC,0x8888}
		local l_masks={0x1111,0x3333,0x7777}
		fill_pattern=bxor(lshr(band(fill_pattern,r_masks[x]),x),shl(band(fill_pattern,l_masks[x]),4-x))
	end

	return bxor(fill_pattern,add_bits)
end

[ Continue Reading.. ]

31
20 comments



Cart #45809 | 2017-11-02 | Code ▽ | Embed ▽ | No License
28

This is a remake of the old fishing minigame from Legend of Zelda: Links Awakening, it's not precise in any way. I've used nothing but my naked eyes recreating this; along with some nostalgia. Growing up, this was probably one of my favorites for the Game Boy Pocket.

Code by me (@MakkesProjects).
Thanks to @gruber_music for the beautiful music and sfx!
Special thanks to @kometbomb for the simple fade tool!

Nintendo owns all the original sprites and music, this is merely a recreation.

Enjoy.

28
7 comments