I've struggled with collision for a long time, but I've discovered/learned two collision types that can be implemented into just about any game genre.

This is my first time writing a tutorial so please any advice or mistakes a must.

Some background:

**PROBLEMS AND SOLUTIONS OF THESE COLLISIONS WILL BE LOCATED AT THE BOTTOM**

## OBJECT-TO-OBJECT COLLISION

This collision type involves four to eight parameters.

- A first X value (
`x1`

)

I've been trying for a day to figure this out and I can't. There's barely any information online about this. Although it feels like everyone knows it but me.

My idea is on initialize to run a nested for loop and add any enemies to a list. And in the update move them.

I did this and it worked! But it incremented in grids. There's no actual code of this since I deleted it, but I could easily reprogram it, if someone asks what the block was.

Hello, I'm currently testing to see if I can do 3D. And I have a square with 2 polygons, but to make it 3D and apply a rotation matrix I would have to make a Z value. I have no idea how to do that. Any help appreciated!

polygons = { { verts = {{x=40, y=40}, {x=80, y=40}, {x=80, y=80}} }, { verts = {{x=40, y=40}, {x=40, y=80}, {x=80, y=80}} } } function _init() end function _update() end function _draw() cls() for i = 1, #polygons do if polygons[i] and polygons[i].verts then _drawPolygon(polygons[i]) end end end function _drawPolygon(polygon) local total_verts = #polygon.verts for i = 1, total_verts do local next_vert = (i % total_verts) + 1 local x1, y1 = polygon.verts[next_vert].x, polygon.verts[next_vert].y local x2, y2 = polygon.verts[i].x, polygon.verts[i].y line(x1, y1, x2, y2, 7) end end |

Hello everyone! I'm wondering how I could have multiple animations? Like an idle, walking, running, etc. The problem is that when I run (which is the else) It goes through the whole animation sheet, I know why but have no clue how to tackle.

Responses much appreciated!

-- player anim if not pl.wlk then if pl.sp <= 4 then pl.sp+=0.01 else pl.sp=1 end else if pl.sp <= 6.9 then pl.sp+=0.1 else pl.sp=5 end end |

Hello everyone! I've been confused for a long time, on how to make multiple pickups items using the same collision function. I want to use the map editor to place them, but give different values to them for example.

A healing potion: +5 health points

A gold coin: +2 money

Instead of all of them just giving +1. Thank you!