Need help with STI

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.
Post Reply
KyleFlores1014
Citizen
Posts: 73
Joined: Thu May 25, 2017 1:43 pm

Need help with STI

Post by KyleFlores1014 »

Im trying out this Simple Tile Implementaion. I found tutorials. I followed this tutorial and wrote it the exact way, but everytime I run it my sprite wont appear but in the tutorial it appears. Im new to this. Help?

(I am trying to achieve the third pic)
Here is the tutorial link: http://lua.space/gamedev/using-tiled-maps-in-love
Game.zip
(166.91 KiB) Downloaded 93 times
User avatar
xNick1
Party member
Posts: 267
Joined: Wed Jun 15, 2016 8:27 am
Location: Rome, Italy

Re: Need help with STI

Post by xNick1 »

Have you checked Karai's github? There are working examples there. There are even some other .love files in his thread about STI in the libraries section. Can't check your code until tomorrow when I'll have a pc.
KyleFlores1014
Citizen
Posts: 73
Joined: Thu May 25, 2017 1:43 pm

Re: Need help with STI

Post by KyleFlores1014 »

Just solved it. My mistake didnt see the problem from the beginning. My only problem now is how do I draw a quad?
User avatar
xNick1
Party member
Posts: 267
Joined: Wed Jun 15, 2016 8:27 am
Location: Rome, Italy

Re: Need help with STI

Post by xNick1 »

How to draw a quad in general?
In this case I repeat the image two times

Code: Select all

function love.load()
    self.x = 0
    self.img = lg.newImage("pic.png")   
    self.img:setWrap("repeat", "repeat")
    self.width = self.img:getWidth()
    self.height = self.img:getHeight()
    self.quad = lg.newQuad(0, 0, 2, self.height, self.img:getDimensions())    
    self.y = 0
    self.sx = 1
    self.sy = 1
end

function love.draw()
    lg.draw(self.img, self.quad, self.x, self.y, 0, self.sx, self.sy)
end
KyleFlores1014
Citizen
Posts: 73
Joined: Thu May 25, 2017 1:43 pm

Re: Need help with STI

Post by KyleFlores1014 »

Sorry for not being that specific. I know how to draw a quad in general, But this library only supports a drawable and I cant seem to add a quad. Do I use spritebatch for this?
User avatar
xNick1
Party member
Posts: 267
Joined: Wed Jun 15, 2016 8:27 am
Location: Rome, Italy

Re: Need help with STI

Post by xNick1 »

KyleFlores1014 wrote: Fri Dec 01, 2017 10:38 am Sorry for not being that specific. I know how to draw a quad in general, But this library only supports a drawable and I cant seem to add a quad. Do I use spritebatch for this?
Sorry, I don't know how to help you.
You could try in the STI thread maybe?
https://love2d.org/forums/viewtopic.php ... &start=720
KyleFlores1014
Citizen
Posts: 73
Joined: Thu May 25, 2017 1:43 pm

Re: Need help with STI

Post by KyleFlores1014 »

Ok, thanks for the help anyways
Post Reply

Who is online

Users browsing this forum: No registered users and 82 guests