Search found 110 matches

by Xugro
Fri Jul 22, 2016 4:53 pm
Forum: Support and Development
Topic: Inventory Management help [SOLVED]
Replies: 3
Views: 2484

Re: Inventory Management help

Plu explained your problem. I modified your code to show you a way to do it.
by Xugro
Sun Jun 19, 2016 12:44 am
Forum: Support and Development
Topic: Best way to detect long-press?
Replies: 4
Views: 2258

Re: Best way to detect long-press?

Add a timer to the button and reset it if the player stops pressing it or if he moves the mouse/finger off the button. For a normal click use a shorter timer that triggers if the player stops pressing the button. See the attached code for an example.
by Xugro
Sun Jun 19, 2016 12:10 am
Forum: Games and Creations
Topic: Video puzzle
Replies: 9
Views: 6956

Video puzzle

Hi folks, I made a small and buggy video puzzle game. The goal is to drag and drop the pieces into the right position. The problem: the content of the puzzle pieces is changing :D. To play the game you have to drag and drop a ogg-theora video into the game. You can find a small one (~15MB) here: htt...
by Xugro
Sat Jun 18, 2016 9:22 pm
Forum: Support and Development
Topic: Puzzle help
Replies: 9
Views: 4469

Re: Puzzle help

You could take a look at my code. Just click on the piece you want to move. If you manage to get every piece into position it shows you the complete picture. The idea is that you look at which piece a player clicks. If the empty space is next to it, then you switch the places of the clicked piece an...
by Xugro
Mon Jun 13, 2016 10:52 pm
Forum: Support and Development
Topic: Getting folder contents with lua socket?
Replies: 5
Views: 1981

Re: Getting folder contents with lua socket?

You can use directory listing and parse the output. For nginx - what you are using on your server - you can use this tutorial: http://nginxlibrary.com/enable-directory-listing/ With directory listing active, you can make an HTTP-request to the folder url and parse the HTML, that the server gives you...
by Xugro
Thu May 05, 2016 9:31 pm
Forum: General
Topic: Concise game implementations
Replies: 6
Views: 4211

Re: Concise game implementations

Graphical snake in 73 lines of code. There are magic numbers in there, but it should be easily understandable. Controls: arrow keys for moving Esc or q to quit There are no borders and the game restarts itself two seconds after losing it. My trimmed down version is just 51 lines of code long.
by Xugro
Sun Apr 24, 2016 12:52 pm
Forum: Games and Creations
Topic: My Own Tile Based Game
Replies: 3
Views: 3663

Re: My Own Tile Based Game

Works nicely. :) I just looked at the code and noticed two things: You reload a lot of images every time you use them. Just load them in love.load() and use them when you need them. You could use something like this: function love.load() -- load all images once and save them player.image["up&qu...
by Xugro
Sun Jan 31, 2016 5:07 pm
Forum: Support and Development
Topic: File I/O with bytes
Replies: 6
Views: 3415

Re: File I/O with bytes

Your Code works on my machine. Have you looked in the right place (see: https://love2d.org/wiki/love.filesystem)? The file test.bin is not saved where the .love file is. You have to look in the save directory of love.
by Xugro
Tue Jan 26, 2016 8:17 pm
Forum: Support and Development
Topic: [Solved] Math.random creates a weird pattern
Replies: 5
Views: 3023

Re: Math.random creates a weird pattern

Your idea of saving a sparse matrix is flawed. I just saved the full matrix and it works (see attached code). If you fill in 90% of the boxes then it is better to store the complete matrix. Edit: ipairs iterates over integer keys, starting from 1, until it finds one which is not in the table. Sourc...
by Xugro
Fri Jan 15, 2016 9:05 pm
Forum: Libraries and Tools
Topic: Graphoon (Now with online demo)
Replies: 13
Views: 7868

Re: Graphoon

It's not perfect either: First of all the runtime increases exponentially with each added node (I have an idea how to break it down using a spatial index, but haven't tried implementing one yet) and there still are some cases where the graph will "explode" or not form a nice layout. I hav...