Search found 12 matches

by MrGreen
Sat Aug 03, 2019 10:34 pm
Forum: Support and Development
Topic: 3 doesn't equal 3?
Replies: 29
Views: 15850

Re: 3 doesn't equal 3?

As for k and s, the relevant wiki entry for love.keypressed explains, those are parameters that get filled when löve calls the function, similarly to how dt is passed in love.update by löve itself. k is for the representation of a key (called keyconstant on the wiki), while s represents the physica...
by MrGreen
Fri Aug 02, 2019 7:32 pm
Forum: Support and Development
Topic: 3 doesn't equal 3?
Replies: 29
Views: 15850

Re: 3 doesn't equal 3?

Okay, thanks a lot.
by MrGreen
Fri Aug 02, 2019 6:49 pm
Forum: Support and Development
Topic: 3 doesn't equal 3?
Replies: 29
Views: 15850

Re: 3 doesn't equal 3?

love.keypressed = function(k,s) if s == 'up' then direction[1] = love.keyboard.isScancodeDown('down') and direction[1] or 1.0 Could you explain me these three lines again? What is k for and how is s changed? And direction[1] cannot be 3 or 2 values at once. What does that do then? Apart from that, ...
by MrGreen
Fri Aug 02, 2019 2:38 pm
Forum: Support and Development
Topic: 3 doesn't equal 3?
Replies: 29
Views: 15850

Re: 3 doesn't equal 3?

YoungNeer wrote: Fri Aug 02, 2019 2:31 pm

Code: Select all

	function love.update(dt)
		if love.keyboard.lastKeyPressed=='up' then
			-- your logic here
		end
		love.keyboard.lastKeyPressed=nil
	end

	function love.keypressed(key)
		love.keyboard.lastKeyPressed=key
	end
Thanks a lot I will try this.
by MrGreen
Fri Aug 02, 2019 2:32 pm
Forum: Support and Development
Topic: 3 doesn't equal 3?
Replies: 29
Views: 15850

Re: 3 doesn't equal 3?

Plus you don't need to have a background image. You could basically just have a for loop and render rectangles of unit size (let's say 32x32 in this context) :- { and I recommend you change the window size to 992 from 1005 just for this to work well) function love.draw() for j=1,31 do for i=1,31 do...
by MrGreen
Fri Aug 02, 2019 2:19 pm
Forum: Support and Development
Topic: 3 doesn't equal 3?
Replies: 29
Views: 15850

Re: 3 doesn't equal 3?

In your case many variables are unused like 'success' (even if setMode does return a boolean - you don't need anything to store it to some variable for it to work) 'way' (what's the use of 'way'?) and complementary1,...,complementary3. Thank you, I improved and will try to improve this. Also I stro...
by MrGreen
Fri Aug 02, 2019 1:53 pm
Forum: Support and Development
Topic: 3 doesn't equal 3?
Replies: 29
Views: 15850

Re: 3 doesn't equal 3?

Okay, thank you for your advise. I already worked on the structure this afternoon and deleted all unnecessary stuff. And by snack I mean the circle the snake can eat.

Latest version:
SnakeShort.lua
(4.84 KiB) Downloaded 225 times
by MrGreen
Fri Aug 02, 2019 10:13 am
Forum: Support and Development
Topic: 3 doesn't equal 3?
Replies: 29
Views: 15850

Re: 3 doesn't equal 3?

Honestly saying you don't even need that equation on first place! Creating is snake game is much more simpler than that. i don't know why are you making it any more complicated than it already is - but here is an *awesome* snake game that you can refer to. You shouldn't find anything more complicat...
by MrGreen
Thu Aug 01, 2019 11:23 pm
Forum: Support and Development
Topic: 3 doesn't equal 3?
Replies: 29
Views: 15850

Re: 3 doesn't equal 3?

Okay, I think this will be very helpful in the future. Thank you for your help and tips.
by MrGreen
Thu Aug 01, 2019 7:05 pm
Forum: Support and Development
Topic: 3 doesn't equal 3?
Replies: 29
Views: 15850

Re: 3 doesn't equal 3?

pgimeno wrote: Thu Aug 01, 2019 6:42 pm

Code: Select all

x =(4*control[1 + 1]^3-30*control[1 + 1]^2+65*control[1 + 1]-30) / 3
Oh, that is even better.

Rounding worked, too:

Code: Select all

math.floor(4/3*(control[1 + 1])^3-10*(control[1 + 1])^2+65/3*(control[1 + 1])-10)
But I like your idea better. Thank you.