Search found 10 matches

by mynameisnotpaul
Wed Jan 04, 2017 10:57 pm
Forum: Support and Development
Topic: Snake's body not appearing and game crashing for some reason
Replies: 5
Views: 3657

Re: Snake's body not appearing and game crashing for some reason

Yes, the code became much more neat! :3 The issue is actually the same though, like it was before, here are the steps up to the error: You define one element for both snake.x and snake.y in love.load. You define counter to be 1 in love.load. In love update, when enough time elapsed, you set snake.x...
by mynameisnotpaul
Wed Jan 04, 2017 8:17 am
Forum: Support and Development
Topic: Snake's body not appearing and game crashing for some reason
Replies: 5
Views: 3657

Re: Snake's body not appearing and game crashing for some reason

I completely rewrote the code to try doing things a little bit differently to see if it would turn out well, but I'm now struggling to make a trail for my snake. In my for statement it says that the variable that goes up in my for statement is nil, when it isn't. This code is a lot smaller so the er...
by mynameisnotpaul
Tue Jan 03, 2017 11:52 pm
Forum: Support and Development
Topic: Snake's body not appearing and game crashing for some reason
Replies: 5
Views: 3657

Re: Snake's body not appearing and game crashing for some reason

What I meant about the problem being with lastCalc() is that that's what causes the problem at line 75. I'll try implementing what you said when I'm working on it again and I'll see if it gets fixed.
by mynameisnotpaul
Tue Jan 03, 2017 11:08 pm
Forum: Support and Development
Topic: Snake's body not appearing and game crashing for some reason
Replies: 5
Views: 3657

Snake's body not appearing and game crashing for some reason

I'm having (another) problem with my snake game. The code I have for the creation of the snake's body doesn't seem to work, and crashes the game too. I know that the problem that leads to the game crashing is located somewhere in the lastCalc() function, but I have no idea how it causes the game to ...
by mynameisnotpaul
Tue Jan 03, 2017 10:59 pm
Forum: Support and Development
Topic: Problem with movement of snake in planned snake game
Replies: 16
Views: 9154

Re: Problem with movement of snake in planned snake game

Oh right. Yeah we did delta stuff in science class, no idea how I forgot about that.
by mynameisnotpaul
Tue Jan 03, 2017 8:00 pm
Forum: Support and Development
Topic: Problem with movement of snake in planned snake game
Replies: 16
Views: 9154

Re: Problem with movement of snake in planned snake game

Oh, okay, I understand a lot better now.

One more question though. Isn't dt the time in between 2 frames? I know timer.getDelta does that and dt seems to stand for delta but I'm not sure.
by mynameisnotpaul
Mon Jan 02, 2017 10:31 pm
Forum: Support and Development
Topic: Problem with movement of snake in planned snake game
Replies: 16
Views: 9154

Re: Problem with movement of snake in planned snake game

This is also what I would recommend, except you describe it in a bit complicated of a way - you are just talking about substraction. I usually do it like this: local time = 0 function love.update (dt) time = time + dt if time >= time_to_do_stuff then -- do stuff time = time - time_to_do_stuff end e...
by mynameisnotpaul
Mon Jan 02, 2017 10:47 am
Forum: Support and Development
Topic: Problem with movement of snake in planned snake game
Replies: 16
Views: 9154

Re: Problem with movement of snake in planned snake game

Thanks for the help, though! The code you provided doesn't update the snake's x and y coordinates, only grid_x and grid_y. Try either updating x and y along with grid_x and grid_y or drawing the square at grid_x and grid_y instead: love.graphics.rectangle('fill', snakeHead.grid_x, snakeHead.grid_y,...
by mynameisnotpaul
Mon Jan 02, 2017 9:20 am
Forum: Support and Development
Topic: Problem with movement of snake in planned snake game
Replies: 16
Views: 9154

Re: Problem with movement of snake in planned snake game

Note that this will result in the snake's position having non-integer coordinates most of the time, but that can be solved with drawing it out floored in love.draw. (You can also floor it to a "bigger" grid, like, every 20 pixels or so: math.floor(n/20)*20 for example) Hi, thanks for help...
by mynameisnotpaul
Sun Jan 01, 2017 4:39 am
Forum: Support and Development
Topic: Problem with movement of snake in planned snake game
Replies: 16
Views: 9154

Problem with movement of snake in planned snake game

I'm trying to make a snake game, but I have a problem with the movement part. In classic snake, each tile moved is equal to the width of the snake as to stop it from constantly killing itself on impact. I'm trying to do this, but I have no clue how to without tying it to the game's frame rate. I've ...