Search found 113 matches

by Xugro
Sun Oct 04, 2020 9:41 am
Forum: Support and Development
Topic: Square Color Picker
Replies: 9
Views: 5326

Re: Square Color Picker

pgimeno wrote: Sat Oct 03, 2020 11:31 pm I'd suggest using ImageData (and its mapPixel method) for this purpose instead of a canvas.
That's a really good idea. I did not know that this method existed.

After a small test: The code is much cleaner and about 300x faster.
by Xugro
Sat Oct 03, 2020 8:28 pm
Forum: Support and Development
Topic: Square Color Picker
Replies: 9
Views: 5326

Re: Square Color Picker

Yeah, sure. The code is not the prettiest nor the fastest, but it is working.
by Xugro
Sat Oct 03, 2020 7:32 pm
Forum: Support and Development
Topic: Square Color Picker
Replies: 9
Views: 5326

Re: Square Color Picker

Create a square canvas. For a certain hue draw all saturation (x-axis) and brightness (y-axis) levels with two for-loops. Create another canvas and draw all possible hues (e.g. y-axis). Draw those two canvases to the screen. When the user clicks on the saturation-brightness-square: Choose the color ...
by Xugro
Wed Sep 30, 2020 11:59 pm
Forum: Support and Development
Topic: [Solved]Making a character switch images when pressing a button to move
Replies: 3
Views: 2964

Re: Making a character switch images when pressing a button to move

I attached a small example. But as sphyrth sad: This is just one of many solutions.

The basic idea is mostly the same: Save the direction the character is looking in some variable and read it when you draw the image.
by Xugro
Tue Jul 07, 2020 7:10 pm
Forum: Support and Development
Topic: How to pack 3 numbers into an int and then do the reverse
Replies: 2
Views: 2283

Re: How to pack 3 numbers into an int and then do the reverse

I cannot help you with the technical stuff, but I know the trick with the numbers. It is the same trick how one converts binary numbers to decimal numbers and back - just with base 40 and not with base 2. Let say you have three numbers: 0 <= a <= 39, 0 <= b <= 39, 0 <= c <= 39. To convert it into a ...
by Xugro
Mon Jun 15, 2020 9:58 pm
Forum: Support and Development
Topic: Game Code
Replies: 2
Views: 2433

Re: Game Code

The problem is that your code will be loaded and executed first and after that love.load() will be called. This means that player in line 15 is not defined yet. Put that piece of code inside love.update().
by Xugro
Sat Apr 25, 2020 3:34 pm
Forum: Support and Development
Topic: Build Love with Ruby instead of Lua
Replies: 13
Views: 7040

Re: Build Love with Ruby instead of Lua

You could use something like RLua which bind Lua und Ruby together:
RLua is Ruby to Lua bindings library that features nearly complete coverage of Lua C API, seamless translation of Lua and Ruby objects into each other, calling Lua functions from Ruby and vice versa.
by Xugro
Fri Apr 10, 2020 10:26 pm
Forum: Games and Creations
Topic: The Seven Rooms
Replies: 2
Views: 3519

Re: The Seven Rooms

It is a really fun game. At first I thought it was too easy, but it gets really hard. The thing I like the most: The reload animation. It is gorgeous. Level 2-7 took really long - I nearly gave up. And then I gave up at level 3-1. I know what I have to do, but it is just too frustrating. I peeked in...
by Xugro
Fri Mar 20, 2020 5:57 pm
Forum: Support and Development
Topic: How can i install a OOP Framework for Atom and Love ?
Replies: 7
Views: 9263

Re: How can i install a OOP Framework for Atom and Love ?

Take a peek at the documentation of 30log:
https://github.com/Yonaba/30log/wiki

To include the library you just have to add the following line of code:

Code: Select all

local class = require '30log-master/30log'
Have fun :)
by Xugro
Sat Mar 07, 2020 9:17 pm
Forum: Support and Development
Topic: problem with my code
Replies: 2
Views: 4700

Re: problem with my code

You initialize the snake with one head and four tail elements. All of them in on the same spot. In the first update the head then collides with all four of its tails, triggering the death of the snake with its fourth tail element. You can initialize the snake with 3 tail elements, initialize the sna...