Author Topic: [LOVE]Help with spawning boxes  (Read 4766 times)

0 Members and 1 Guest are viewing this topic.

Offline hellninjas

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 625
  • Rating: +17/-0
    • View Profile
[LOVE]Help with spawning boxes
« on: July 01, 2012, 08:24:58 pm »
Boxes don't spawn inside each other (They Spawn inside of each other, I need that to NOT happen)
Any suggestions on what I can do??

Later on im hoping to make it where:
1. all boxes are highlighted on mouse-over
2. you can drag your mouse around and create boxes
3. boxes don't spawn inside of each other (Working on)
4. selecting specific boxes and tell them where to move
5. animation for the movement of the boxes and them colliding with each other
6. boxes having specific properties
7. sprites instead of boxes xD.

Download is below!
Current Version 2
« Last Edit: July 01, 2012, 09:17:53 pm by hellninjas »

Offline Juju

  • Incredibly sexy mare
  • Coder Of Tomorrow
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 5730
  • Rating: +500/-19
  • Weird programmer
    • View Profile
    • juju2143's shed
Re: [LOVE]Help with highlighting
« Reply #1 on: July 01, 2012, 08:32:07 pm »
Yeah I see.

Move the for i=1,25 do line before when you check if the mouse is in a rectangle.

Remember the day the walrus started to fly...

I finally cleared my sig after 4 years you're happy now?
THEGAME
This signature is ridiculously large you've been warned.

The cute mare that used to be in my avatar is Yuki Kagayaki, you can follow her on Facebook and Tumblr.

Offline hellninjas

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 625
  • Rating: +17/-0
    • View Profile
Re: [LOVE]Help with highlighting
« Reply #2 on: July 01, 2012, 08:38:50 pm »
Yeah I see.

Move the for i=1,25 do line before when you check if the mouse is in a rectangle.
Moved it to the beginning of the love.draw() command, but still doesn't work. D:

Offline Juju

  • Incredibly sexy mare
  • Coder Of Tomorrow
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 5730
  • Rating: +500/-19
  • Weird programmer
    • View Profile
    • juju2143's shed
Re: [LOVE]Help with highlighting
« Reply #3 on: July 01, 2012, 08:46:08 pm »
Code: [Select]
function love.draw()
local mouseX,mouseY=love.mouse.getPosition()
love.graphics.draw(mouse,mouseX,mouseY)
for i=1,25 do
if mouseX>=varx[i] and mouseY>=vary[i] and mouseY<vary[i]+varh[i] and mouseX<varx[i]+varw[i] then
love.graphics.setColor(255,0,0,255)
love.graphics.rectangle("fill",varx[i],vary[i],varw[i],varh[i])
end
love.graphics.setColor(0,255,0,255)
love.graphics.rectangle("line",varx[i],vary[i],varw[i],varh[i])
end
end
It should look like this, it works for me.

Remember the day the walrus started to fly...

I finally cleared my sig after 4 years you're happy now?
THEGAME
This signature is ridiculously large you've been warned.

The cute mare that used to be in my avatar is Yuki Kagayaki, you can follow her on Facebook and Tumblr.

Offline hellninjas

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 625
  • Rating: +17/-0
    • View Profile
Re: [LOVE]Help with spawning boxes
« Reply #4 on: July 01, 2012, 09:18:37 pm »
Thanks Juju!
Now onto the next part!
I need to make it where boxes DON'T spawn inside each other.