Last active
October 12, 2022 18:19
-
-
Save Achie72/0ebe3b4db4d0fa8cb78fa9db83f478a1 to your computer and use it in GitHub Desktop.
TIC-80 Dodge Glitch effect
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- made for my Devtober2022 entry | |
| -- you can read the corresponding devlog on: | |
| -- https://ko-fi.com/post/Eng-Devtober2022-4--We-got-to-have-glitch-effe-S6S1FM1IC | |
| -- https://itch.io/jam/devtober-2022/topic/2406837/achies-devlog-shmup-game | |
| if dodgeTimer > 0 then | |
| -- do it for each y level | |
| for i=0,7 do | |
| if math.random() > 0.5 then | |
| local startLine = math.random(-10,0) | |
| local endLine = math.random(0,10) | |
| for j=startLine,endLine do | |
| -- calculate the pixel index | |
| local decPos = math.floor(x+4)+j+((math.floor(y)+i)*240) | |
| -- turn it to hexa | |
| local hexPos = ('%X'):format(decPos) | |
| -- poke | |
| poke4(0x0000+tonumber(hexPos,16),11) | |
| end | |
| end | |
| end | |
| else | |
| -- draw exhaust | |
| draw_outline(4+idx,x+leaning,y+8,0,8) | |
| -- draw ship | |
| draw_outline(2+leaning,x,y,0,8) | |
| if hasShield then | |
| --draw shield | |
| local size = 8*(shield/maxShield) | |
| ellib(x+3,y+4,size,size,11) | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment