[HELP] Falling "sand" timer

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
lolsasory
Prole
Posts: 21
Joined: Mon Nov 19, 2012 5:27 am

[HELP] Falling "sand" timer

Post by lolsasory »

So I have a timer that counts down and every second it "drops" a pixel, I have it stop at the bottom of the screen minus one pixel, but how do I have it interact like falling sand? I've looked at physics in the game but I dont get it. Ive also tried looking at others falling sand games and that doesn't help either.
Attachments
main.love
Ignore the numbers in the corner
(572 Bytes) Downloaded 159 times
User avatar
artofwork
Citizen
Posts: 91
Joined: Mon Sep 15, 2014 1:17 am
Location: East Coast USA

Re: [HELP] Falling "sand" timer

Post by artofwork »

Your code has no physics at all, sure your using a rectangle to draw on screen in the Y but your not telling love, Hey! these rectangles are physical objects treat them as such.

Use this tutorial below and change your code accordingly.
http://www.love2d.org/wiki/Tutorial:Physics
Jepcats
Prole
Posts: 8
Joined: Thu Sep 18, 2014 3:19 pm

Re: [HELP] Falling "sand" timer

Post by Jepcats »

You can also implement your own gravity, collision detection, and things like that as well if you like. You could do something like for each sand grain check what the positions and velocities of the neighbouring sand grains are and update accordingly.
Post Reply

Who is online

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