Log In  
Follow
ManlishPotato
[ :: Read More :: ]

Cart #rotatespritewip-0 | 2022-09-06 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
1


I'm trying to rotate a sprite from the sprite sheet, and I think I'm semi successful.
The problem I have been noticing is that when the sprite is turning it will have holes in the drawing, no matter which sprite it is. I think what is happening is that it's rounding of the coordinates to the closest, and this sometimes draws two pixels on top of each other. At least that's what I think is happening.
In what way do you typically solve this? Draw a color in the blanks that is a close match, or like a background color?
Can you cleverly ensure that pixels never get's drawn on top of each other?

P#116975 2022-09-06 17:51

[ :: Read More :: ]

Cart #tetriswip-2 | 2020-02-07 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
2

Hello there!

I'm making a Tetris clone that uses the map to save tile data. The program draws the tetraminoes using 2 'for' loops and a table that has start and center information, but also how many columns and rows to draw in this config:
table_x={startx,starty, row1x,row1y,n row1, row2x,row2y,n row2}

The program is supposed to check if it has a second row:
if(table[6]!=nil) then
pos_x,pos_y=0,0
for n=1,table[8],1 do
rot_x,rot_y=rot(table[6]+pos_x,table[7]+pos_y)
for v=0,7,7 do
for b=0,7,7 do
if(op=="gravity") then
flag=fget(mget((p1.x+rot_x+b)/8,(p1.y+rot_y+v)/8),0)
if(flag) then
....
and normally it works, but sometimes out of random i get this error:
runtime error line 146 tab 0
rot_x,rot_y=rot(table[6]+pos_x,table[7]+pos_y)
attempt to perform arithmetic on field '?' (a nil value)
in collision line 146 (tab 0)
in _update line 40 (tab 0)
at line 0 (tab 0)
....
which is super weird, if you print what table was active, it'l usually spit out table: tet_i which doesn't have a second row, meaning that if(table[6]!=nil) should return false, meaning the error code should not be executed.
If you want to force the runtime error you can make a tower so that you would normally get a game over, but since i haven't programmed one the program keeps spitting out tetraminoes, rapidly speeding the process up, and increasing the chance that you get an error.

I have no idea why this is, any ideas is appreciated!
Thanks in advance, Benji.

P#72851 2020-02-07 01:01 ( Edited 2020-02-07 20:19)

[ :: Read More :: ]

Cart #tetriswip-2 | 2020-02-07 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
2

P#72842 2020-02-06 22:39 ( Edited 2020-02-07 20:12)

[ :: Read More :: ]



Hi my name is Benjamin and this is my first cartridge.
In this I am showcasing how to do very simple collision detection, inspired by Scathes game which you can find here: https://www.lexaloffle.com/bbs/?tid=3116

Don't be afraid to ask questions if you have any!

P#32978 2016-12-03 16:03 ( Edited 2016-12-08 13:01)

Follow Lexaloffle:          
Generated 2024-04-19 15:15:32 | 0.092s | Q:18