I made a function to draw an equilateral triangle that I could animate:
function triangle(_x,_y,_size,_angle,_clr) for i=0,2 do local _offset=.33*i local _x1=_x+(cos(_angle+_offset)*_size) local _y1=_y+(sin(_angle+_offset)*_size) line(_x1,_y1,_clr+i) end end |
Pico 8 does something weird when I try to draw 2 triangles made out of lines:
I can draw each triangle just fine, but when I put the triangle() function twice it weirdly connects the triangles.
I have no idea why it does that, I could use some help.
here's the full code
function _init() end function _update() end function _draw() cls() triangle(64,64,30,0.255,8) triangle(64,64,30,0.255+0.5,12) end function triangle(_x,_y,_size,_angle,_clr) for i=0,2 do local _offset=.33*i local _x1=_x+(cos(_angle+_offset)*_size) local _y1=_y+(sin(_angle+_offset)*_size) line(_x1,_y1,_clr+i) end end |
So I logged in recently to check my game here, and I see now that the death animation is totally broken. the death animation loops when it shouldn't and the fadeout animation is really slow.
I have on my PC the version I downloaded a year ago, and the game is working fine on that version.
Was there something that changed with how Pico8 calculate things?
Link to my game The World Under
https://www.lexaloffle.com/bbs/?tid=48726
The World Under
a game by Mikimation aka Miki Hakim
Controls:
Left\Right - Walk
Up - Interact
Down - Defend
Z - Attack
X - Jump
Down + X - Roll Dodge
Dev notes
I am an animator by profession. I've had a big project this year in After Effects that made me required me to learn some programming. Around that time I discovered Pico 8 and fell in love with the platform and a lot of the games made by the community. I decided I want to fulfill a dream I've had for 20 years now and make a game, like the games I used to grow up on in the 90s.
I've started doing some tutorials, and what started as a small project developed into making a full-on game.
I have learned a lot through the process. With each mechanic I wanted to put on the game I needed to learn more about programming in Lua and math.
I'm trying to make a radial sight function for the enemies in my game
I want them to know if the player has entered a radius around them, and be able to control the angle of their sight according to their direction
So basically it's checking if the player has entered a sector of the radius around them, and also being able to control the percentage of the sector and its direction.
I thought about splitting the radius around them into directions, as seen in the image. I'm not sure if that's right.
I'm terrible at math so I couldn't figure this one out, I'd appreciate the help
this is the closest solution that I found, but I couldn't make it work
https://www.geeksforgeeks.org/check-whether-point-exists-circle-sector-not/
I'm trying to make a tentacle using sin().
I want the base (the top circle) to be static, and the wiggle of the tentacle to get stronger until it reaches the tip (the bottom circle).
So far I have only achieved a pendulum
I'm not that good with math so I'm not sure about how to do it
here's my code
function _init() length=20 x=64 y=40 end function _draw() cls() for i=0,length do circfill(x+sin(time())*i,y+i*4,length-i,14) end end |
I'm working on a platformer game. I'm having an issue with enemy AI.
I want that the enemy will turn the opposite way once it reaches a cliff, much like a collision with a wall.
I want to make a collision check that will check if the floor of the tile after the enemy doesn't have any flags.
How do I do that if 0 means the first flag?