Search found 7 matches

by zynerd
Tue May 26, 2015 12:04 am
Forum: Support and Development
Topic: [HELP] Shoot in one direction at a time
Replies: 5
Views: 2606

Re: [HELP] Shoot in one direction at a time

davisdude wrote:Sure. Whenever you set player.directionFiring set another variable called player.shootTimer to whatever time you want. Inside of player.update subtract dt from the cooldown. Then inside of love.keypressed check if the cooldown is < 0 in order to fire.
Awesome, thanks.
by zynerd
Mon May 25, 2015 11:34 pm
Forum: Support and Development
Topic: [HELP] Shoot in one direction at a time
Replies: 5
Views: 2606

Re: [HELP] Shoot in one direction at a time

Make a variable called "player.directionFiring" or something like that. Inside of love.keypressed, if the key is one of the directions you have, set it to that direction. Then, inside of player.shoot you can say if player.directionFiring then And do the logic but with a variable instead. ...
by zynerd
Mon May 25, 2015 11:23 pm
Forum: Support and Development
Topic: [HELP] Shoot in one direction at a time
Replies: 5
Views: 2606

Re: [HELP] Shoot in one direction at a time

Make a variable called "player.directionFiring" or something like that. Inside of love.keypressed, if the key is one of the directions you have, set it to that direction. Then, inside of player.shoot you can say if player.directionFiring then And do the logic but with a variable instead. ...
by zynerd
Mon May 25, 2015 10:55 pm
Forum: Support and Development
Topic: [HELP] Shoot in one direction at a time
Replies: 5
Views: 2606

[HELP] Shoot in one direction at a time

Hi, I'm making a basic game in Love where the player can shoot bullets at enemies. I'm trying to restrict the player to shooting in one direction at a time so the player can't spam bullets in all directions. Here's the part of the code I need modified: function player.shoot(key) if gameState == &quo...
by zynerd
Sun May 24, 2015 11:29 pm
Forum: Support and Development
Topic: [HELP] attempt to perform arithmetic on field 'width'
Replies: 5
Views: 2909

Re: [HELP] attempt to perform arithmetic on field 'width'

function bullet.spawn(x,y,dir) table.insert(bullet, {x = x, y = y, dir = dir}) end This version doesn't assign all the properties the one in your post does. Are you somehow using two versions of your game next to each other? Also, why are you using 0.8, BTW? 0.9 has a lot of great improvements . Th...
by zynerd
Sun May 24, 2015 11:13 pm
Forum: Support and Development
Topic: [HELP] attempt to perform arithmetic on field 'width'
Replies: 5
Views: 2909

Re: [HELP] attempt to perform arithmetic on field 'width'

Robin wrote:I can't find the problem right now.

Please upload a .love so that we can use our own debugging tools to look for the problem.
Sorry, here ya go:

WASD to move, arrow keys to shoot.

(Forgot to mention, I'm using love 8.0)
by zynerd
Sun May 24, 2015 10:30 pm
Forum: Support and Development
Topic: [HELP] attempt to perform arithmetic on field 'width'
Replies: 5
Views: 2909

[HELP] attempt to perform arithmetic on field 'width'

EDIT: Solved the problem! Hey, I started making making a game with Love2d, and when creating a function for bullet collision, I came across the following error: enemy.lua:106: attempt to perform arithmetic on field 'width' (a nil value) Line 106 in enemy.lua is the following: if va.x + va.width > v...