Is it possible to tile a triangle like you can with quads?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Dialglex
Prole
Posts: 9
Joined: Tue Feb 07, 2017 6:14 am

Is it possible to tile a triangle like you can with quads?

Post by Dialglex »

I am making a platformer map with slopes but I am not sure how to give a triangle a tile effect.
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: Is it possible to tile a triangle like you can with quads?

Post by Positive07 »

Have you checked the wiki on [wiki]Mesh[/wiki]es? They have a lot of arguments but they basically allow you to create some weird [wiki]Quad[/wiki]s using UV coordinates (the coordinate in the image) and coordinates (the coordinate in screen) for each vertex. And you get the extra benefit of per-vertex attributes like colors and whatever you may add
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
User avatar
peterrust
Prole
Posts: 42
Joined: Thu Dec 29, 2016 8:49 pm
Location: Bellingham, WA, USA
Contact:

Re: Is it possible to tile a triangle like you can with quads?

Post by peterrust »

Dialglex, I haven't done it myself, but my impression is that people typically create a rectangular tile image, where half of the image is transparent and the other half is "painted" with the triangle image. But an actual triangle is input into the physics system (I don't think the bump collision library has support for triangles/slopes, so hardon-collider or box2d/physics is probably used). But others with more knowledge can probably correct me and give more details.
Dialglex
Prole
Posts: 9
Joined: Tue Feb 07, 2017 6:14 am

Re: Is it possible to tile a triangle like you can with quads?

Post by Dialglex »

peterrust, how would I make half of it transparent? I already had the idea, but I just didn't know how to do it.
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: Is it possible to tile a triangle like you can with quads?

Post by Positive07 »

You edit it with a software like GIMP, Photoshop or other image editor
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
User avatar
peterrust
Prole
Posts: 42
Joined: Thu Dec 29, 2016 8:49 pm
Location: Bellingham, WA, USA
Contact:

Re: Is it possible to tile a triangle like you can with quads?

Post by peterrust »

Dialglex wrote:how would I make half of it transparent?
Positive07 wrote:You edit it with a software like GIMP, Photoshop or other image editor
Right... gimp and Photoshop are so powerful, they can be hard to figure out. There are plenty of smaller image editors out there, I really like aseprite, which is designed for pixel art, but it's not free. http://www.piskelapp.com/ is an online one that's free, I'm sure there are others. You'll probably want to save in the PNG format, which has good support for transparency. How exactly to make half the pixels transparent depends on the editor, sometimes there will be a "Background Color" property that you can set to a fully transparent color, other times you can just use an eraser tool to clear out the pixels that you want to be transparent.
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: Is it possible to tile a triangle like you can with quads?

Post by Positive07 »

I didn't want to recommend a pixel art oriented tool for the simple reason that he may not be using those kind of graphics, and editting real graphics with a pixel art tool is not really what you want. The magic wand in both GIMP and Photoshop is really simple to use and you can easily remove everything that is made of the same (or similar) color
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
Dialglex
Prole
Posts: 9
Joined: Tue Feb 07, 2017 6:14 am

Re: Is it possible to tile a triangle like you can with quads?

Post by Dialglex »

Thanks for the replies, I have used meshes and it is almost done but it is stretching the image because it is it is not a square shaped triangle. How would I make it not stretch?
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Is it possible to tile a triangle like you can with quads?

Post by raidho36 »

You need to use proper UV coordinates, is all.
Dialglex
Prole
Posts: 9
Joined: Tue Feb 07, 2017 6:14 am

Re: Is it possible to tile a triangle like you can with quads?

Post by Dialglex »

I am but all it is doing is tilting the image.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests