Search found 3 matches

by NathanGaming2005
Fri Jan 11, 2019 10:07 am
Forum: Support and Development
Topic: [Solved]i want to make the enemy kill the player but it keeps giving me the error(read below)
Replies: 4
Views: 3212

Re: i want to make the enemy kill the player but it keeps giving me the error(read below)

i got it the new code detects if the enemy touches the player
like

Code: Select all

for I, v in pairs(enemies) do
 if aabb(player.x,player.y,player.width,player.height) then
 player_die()
end



end

function player_die()
game_load()
player.x = 50
player.y = 50
player.speed = 400
end
by NathanGaming2005
Fri Jan 04, 2019 2:29 pm
Forum: Support and Development
Topic: [Solved]i want to make the enemy kill the player but it keeps giving me the error(read below)
Replies: 4
Views: 3212

[Solved]i want to make the enemy kill the player but it keeps giving me the error(read below)

function love.load() player = {x = 200,y = 200,Speed = 400, width = 30, height = 50} enemy = {x = 150,y = 150, speed = 1000} points = {{x = 400,y = 555}} pointscounter = 0 end function love.draw() love.graphics.setColor(144,255,71) [b]Here[/b] for i, v in pairs(player) do love.graphics.rectangle(&q...
by NathanGaming2005
Fri Jan 04, 2019 11:50 am
Forum: Support and Development
Topic: [SOLVED] Make an object follow another object.
Replies: 12
Views: 11072

Re: Make an object follow another object.

function fish_move(dt) dx = (player.x - fish.x) * (fish.speed * dt) dy = (player.y - fish.y) * (fish.speed * dt) fish.x = fish.x + (dx * dt) fish.y = fish.y + (dy * dt) end I'd do it the same way, with two further modification. First, you put in dt twice. You only need it once for each coordinate. ...