cool demos and miscellania

Show off your games, demos and other (playable) creations.
Post Reply
User avatar
jojomickymack
Prole
Posts: 45
Joined: Tue Dec 26, 2017 4:52 pm

cool demos and miscellania

Post by jojomickymack »

I thought that parallaxing tilemaps with STI would be difficult - not so, just add some offsets and multiply the dx values for background layers by 0.9 or lower depending on the rate you want it to scroll. I'm certain there's a better way just using layers in a single map, but this appears to be working.
parallax_follow.gif
parallax_follow.gif (466.53 KiB) Viewed 2642 times
Attachments
parallax_test001.love
(26.86 KiB) Downloaded 105 times
User avatar
jojomickymack
Prole
Posts: 45
Joined: Tue Dec 26, 2017 4:52 pm

Re: cool demos and miscellania

Post by jojomickymack »

Somebody was trying to attach a texture to a physics world polygon shape, it can be done using a mesh. Polygons have vertices in the physics world and when they're rendered by graphics.drawPolygon() and there's a limit of 8. That's standard for box2d, the reason being you can assemble multiple polygons together to make whatever shape you want.

A mesh has unlimited vertices - unfortunately the way the tables of points get returned from calls to Body:getWorldPoints(shape:getPoints()) doesn't match up with mesh:setVertices(), so you've got to pack the coordinates into the mesh tables before rendering it with graphics.draw().

Provided that is happening, textured meshes with physics world vertices works pretty well in love2d!
texture.gif
texture.gif (376.14 KiB) Viewed 2587 times
Attachments
polygon001.love
(149.05 KiB) Downloaded 90 times
User avatar
jojomickymack
Prole
Posts: 45
Joined: Tue Dec 26, 2017 4:52 pm

Re: cool demos and miscellania

Post by jojomickymack »

Instead of scaling and translating based on the position of the player, instead use the center of the window or the position of the mouse.

Code: Select all

    dx = (love.graphics.getWidth() / 2) - (love.graphics.getWidth() / 2) / scale
    dy = (love.graphics.getHeight() / 2) - (love.graphics.getHeight() / 2) / scale
    --dx = (love.mouse.getX()) - (love.graphics.getWidth() / 2) / scale
    --dy = (love.mouse.getY()) - (love.graphics.getHeight() / 2) / scale

    love.graphics.scale(scale)
    love.graphics.translate(-dx, -dy)
zoom_to_center.gif
zoom_to_center.gif (433.72 KiB) Viewed 2452 times
Attachments
zoom_to_point.love
(465.95 KiB) Downloaded 86 times
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 30 guests