Search found 82 matches

by Xugro
Thu Jan 07, 2021 11:58 am
Forum: Support and Development
Topic: [Solved] Pointing at an object that's out of sight
Replies: 14
Views: 1980

Re: Pointing at an object that's out of sight

Yes, that is the formula to calculate the angle. But that is the easy part. Calculating the point on the border is harder. But I found a simpler in my sleep (simpler than what I thought of yesterday): calculate_intersection.jpg The first step is to find out which screen-border the pointer needs to b...
by Xugro
Wed Jan 06, 2021 11:50 pm
Forum: Support and Development
Topic: [Solved] Pointing at an object that's out of sight
Replies: 14
Views: 1980

Re: Pointing at an object that's out of sight

There are many ways to do this. It depends on what you want. I can see two possibilities: A simple approach, where you just point in the approximate direction: simple.jpg Hereby you determine in which part of the playing field the object/enemy (X) is relative to the player (P): the number shown. Her...
by Xugro
Sat Oct 17, 2020 7:00 pm
Forum: Support and Development
Topic: I searched but no answer so I have to come here and asking this coding problem
Replies: 9
Views: 3718

Re: I searched but no answer so I have to come here and asking this coding problem

Personally: I do not know. Can you expand on this: What do you want to achieve? I mean, like: somewords=love.graphics.newText(...) somewords=somewords:setf(wraplimit), not include using a new text to replace original text. or just: somewords=love.graphics.newFormatText(...) Okay, that I understand....
by Xugro
Fri Oct 16, 2020 8:08 pm
Forum: Support and Development
Topic: I searched but no answer so I have to come here and asking this coding problem
Replies: 9
Views: 3718

Re: I searched but no answer so I have to come here and asking this coding problem

always report argument #3 to 'setf' (string expected, got no value) If you take a look at the wiki entry for Text:setf : You need to give the function three parameters: The new text to draw The number of pixels before wrapping And the alignment of the text (left, right center or justify) The error ...
by Xugro
Mon Oct 12, 2020 5:23 pm
Forum: Support and Development
Topic: COINS & HURDLES
Replies: 7
Views: 2141

Re: COINS & HURDLES

You have to init the CoinSeries. If you dont there are no coins in the coins-list. And therefore no coins will be rendered.
by Xugro
Sun Oct 11, 2020 5:06 pm
Forum: Support and Development
Topic: COINS & HURDLES
Replies: 7
Views: 2141

Re: COINS & HURDLES

You use the init-function of the coin to set its position. Create a(n additional) constructor where you can give the coin the x-position you want it to have: function Coin:initWithX(x) self.x = x self.y = 600 self.width = Coin_image:getWidth() self.height = 32 end Now create a CoinSeries-Object, tha...
by Xugro
Sat Oct 10, 2020 9:37 pm
Forum: Support and Development
Topic: COINS & HURDLES
Replies: 7
Views: 2141

Re: COINS & HURDLES

Could you upload a .love file of your project and a small sketch of what you want please? That would make it much easier for us to help you. I am not sure what you want. If I had to guess: You want a coin block that has multiple coins inside. Something like this: https://www.youtube.com/watch?v=qovH...
by Xugro
Wed Oct 07, 2020 7:32 pm
Forum: Games and Creations
Topic: Collisions and images
Replies: 8
Views: 3427

Re: Collisions and images

It sounds like you are using AABB Collision Detection. That should work. What is the problem with your collision detection? My first guess would be that your bullets are too fast, but there can be others problems. Here is a short article about AABB Collision Detection: https://tutorialedge.net/gamed...
by Xugro
Mon Oct 05, 2020 9:26 pm
Forum: Support and Development
Topic: make line dissapear after 'x' seconds
Replies: 1
Views: 1235

Re: make line dissapear after 'x' seconds

To make the line disappear after x seconds. Save the remaining time in a variable and reduce it in love.update until it is zero (or less). If this happens delete the line: function love.load() remaining_time = x end function love.update(dt) remaining_time = remaining_time - dt if remaining_time <= 0...
by Xugro
Sun Oct 04, 2020 9:41 am
Forum: Support and Development
Topic: Square Color Picker
Replies: 9
Views: 1944

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.