Now I'm new to programming i've been at it for like 3 days now.I've been making simple games like adventure games were you click buttons for answers like the walking dead


thanks for the help
-SSheep_
Code: Select all
if x > box.x and x < box.x+box.width and y > box.y and y < box.y+box.height then
-- the (x,y) coordinates are inside the box
end
Code: Select all
function dist(x1,y1,x2,y2)
return (math.sqrt((x1-x2)^2+(y1-y2)^2)))
end
Code: Select all
if dist(circle.x,circle.y,x,y) <= circle.radius then
-- point is inside the circle
end
Code: Select all
if dist(circle1.x,circle1.y,circle2.x,circle2.y) < cirlce1.radius+circle2.radius then
-- the two circle are colliding
end
Code: Select all
if obj1.x+obj1.width < obj2.x or obj1.x > obj2.x+obj2.width or obj1.y+obj1.height < obj2.y or obj1.y > obj2.y+obj2.height then
--the two rectangles are colliding
end
Code: Select all
require "player"
function love.load()
love.graphics.setBackgroundColor(255,255,255)
gameState = "playing"
boxX = 100
boxY = 100
boxWidth = 32
boxHeight = 32
end
function love.update(dt)
if gameState == "playing" then
playerMove(dt)
if player.x > boxX and player.x < boxX + boxWidth and player.y > boxY and player.y < boxY + boxHeight then
love.graphics.setColor(255,20,0)
love.graphics.print("test", 200,200)
end
end
end
function love.draw()
if gameState == "playing" then
playerDraw()
love.graphics.setColor(255,20,0)
love.graphics.rectangle("fill", boxX, boxY, boxWidth, boxHeight)
end
end
I acutely fixed it i just copied the code and past it again and it worked lolRanguna259 wrote:Hmmm.. This looks really wierd, everything looks fine.
Could you post the .love ?
Users browsing this forum: Ahrefs [Bot], Google [Bot] and 6 guests