grid sample

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
elsalvador
Citizen
Posts: 54
Joined: Thu Oct 24, 2013 1:29 am

grid sample

Post by elsalvador »

i took the grid-collision sample from love2d tutorials
and i changed this:

Code: Select all

love.graphics.rectangle("line", x * 32, y * 32, 32, 32)
to this:

Code: Select all

 love.graphics.rectangle("fill", (x-1) * 32 , (y-1) * 32,  32, 32)
and now nothing its accurate??? WHY :( what did I do wrong??

HERE:
Attachments
grids.love
(2.31 KiB) Downloaded 55 times
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: grid sample

Post by Karai17 »

Because you are only drawing the rectangles as offsets, the data is still the same. You will also need to offset the "player" square, too.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
elsalvador
Citizen
Posts: 54
Joined: Thu Oct 24, 2013 1:29 am

Re: grid sample

Post by elsalvador »

ugh..
confuse now!
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: grid sample

Post by Karai17 »

Well, let's say x = 5. What you're saying is "draw the 5th x where the 4th x is", and so on. Player is still being drawn where it is located, so the map is shifted left while Player isn't.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
pielago
Party member
Posts: 142
Joined: Fri Jun 14, 2013 10:41 am

Re: grid sample

Post by pielago »

okay get it..
now question what if the player its not the same as the grid? will still work?
i see grid cells are the same as the player 32x32 but what if the player its idk 50x100 ??
will the grid still work or is there another way and if so can someone point me to it????? :awesome:
beside grids but the same idea like grids :)
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: grid sample

Post by Karai17 »

You'll want everything to use the same offset, regardless of size.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
pielago
Party member
Posts: 142
Joined: Fri Jun 14, 2013 10:41 am

Re: grid sample

Post by pielago »

i can tell your good at it well i will try and if cant ... ill sure message you :) if you don't mind :)
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: grid sample

Post by Karai17 »

After building a library to do all of this, I'd like to think I know what I am doing. ;D
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 3 guests