Search found 110 matches

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

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

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

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

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

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

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

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...
by Xugro
Tue Dec 17, 2019 8:51 pm
Forum: Support and Development
Topic: Bug(s ?) in my code | main.lua:1201: attempt to index local 'pSprite' (a nil value)
Replies: 5
Views: 5196

Re: Bug(s ?) in my code | main.lua:1201: attempt to index local 'pSprite' (a nil value)

If you call the function playerDeath() in love.update(dt) you initialize a new lstSprites . After creating a new player you jump back into the code line where playerDeath() was called. And there the local loop variable nSprite is still iterating over the old number of #lstSprites . Since there are n...
by Xugro
Sat Dec 14, 2019 10:08 pm
Forum: Support and Development
Topic: Bug(s ?) in my code | main.lua:1201: attempt to index local 'pSprite' (a nil value)
Replies: 5
Views: 5196

Re: Bug(s ?) in my code | main.lua:1201: attempt to index local 'pSprite' (a nil value)

You should upload your .love file. Then someone can take a look at the source code to find the bug. Just a wild guess: You delete sprites by lstSprites[index] = nil This creates gaps in the table. So the table has the same length before deletion, but one index is emtpy. If you try to access that ind...
by Xugro
Sat Oct 26, 2019 10:24 pm
Forum: Support and Development
Topic: [Solved]Snake Game: unable to draw tail correctly
Replies: 2
Views: 2882

Re: Snake Game: unable to draw tail correctly

Reverse the order of the tail-update in line 31 from for i = #tail, 1, -1 do to for i = 1, #tail do and it will work. In your version the position of an element will be set on the position of the previous element and all tail-elements will be on the same position after the update. And if you know th...