Search found 67 matches

by Xugro
Sat Jun 18, 2016 9:22 pm
Forum: Support and Development
Topic: Puzzle help
Replies: 9
Views: 2211

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: 834

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: 1395

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: 1729

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"] = lov...
by Xugro
Sun Jan 31, 2016 5:07 pm
Forum: Support and Development
Topic: File I/O with bytes
Replies: 6
Views: 1067

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: 842

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: 3548

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 have the same...
by Xugro
Thu Oct 29, 2015 11:49 pm
Forum: Support and Development
Topic: Detecting a mouse shake?
Replies: 3
Views: 620

Re: Detecting a mouse shake?

I wrote a small program, that should do the trick.

The idea behind it: If you are in an small enough area, then you are really shaking and not just moving the mouse around and getting back to the starting point. In my case I just made an rectangular approximation, but it does the job.
by Xugro
Sun Aug 16, 2015 1:00 am
Forum: Libraries and Tools
Topic: paintonline - online paint (for painting online)
Replies: 51
Views: 11620

Re: PENISDRAW - draw dicks with friends ONLINE!

my request: please share your custom stuff for automated drawing if you made something cool Here is my code for pasting images. Works with Version 2. Just add this to the love.keypressed function. if (not text and key=='p') then local saved_color = current_color current_width = math.max(current_wid...
by Xugro
Mon Aug 10, 2015 3:52 pm
Forum: Support and Development
Topic: Cards and tile-based playboard for rivals of catan
Replies: 5
Views: 1097

Re: Cards and tile-based playboard for rivals of catan

now i tried to include a 2-dimensional table, but i can't figure out why it doesn't work.. [...] but all they give back is "Tileset is not defined (value:nil)". You never declared the table Tileset . You must create the table first and fill it with images. also my cards have 4 sides with each a dif...