:Move To Error?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
lelSkrub
Prole
Posts: 6
Joined: Fri Jan 09, 2015 2:27 am

:Move To Error?

Post by lelSkrub »

Hi! I'm having a problem with my game

When i run my game, it gives me the error on this line

Code: Select all

	mouse:setPosition(love.mouse.getPosition())
mouse is a [wiki]HardonCollider [/wiki] circle hitbox for the mouse

my main.lua (warning, very messy code xD )

Code: Select all

HC = require 'hardoncollider'
local text = {}

function on_collision(dt, shape_a, shape_b, mtv_x, mtv_y)
    text[#text+1] = string.format("Colliding. mtv = (%s,%s)", 
                                    mtv_x, mtv_y)
end

function collision_stop(dt, shape_a, shape_b)
    text[#text+1] = "Stopped colliding"
end

function love.load()
	Collider = HC(100, on_collision, collision_stop)
	kimBox = Collider:addRectangle(200, 400, 191, 261)
	mouse = Collider:addCircle(400, 300, 20)
	mouse:moveTo(love.mouse.getPosition())
	warningtxt = "A very small portion of the population have a condition which may cause them to experience epileptic seizures or have momentary loss of consciousness when seeing fast flashing lights. Players who have not had any previous seizures may nonetheless have an undetected epileptic condition. If you or anyone in your family has experienced symptoms linked to an epileptic condition (e.g. a seizure or loss of awareness), immediately consult your physician before playing games like this one. We recommend that parents observe their children while they play video games. If you or your child experience any of the following symptoms: dizziness, altered vision, eye or muscle twitching, involuntary movements, loss of awareness, disorientation, or convulsions, DISCONTINUE USE IMMEDIATELY and consult your physician."
	lel = {"lol get rekt", "wht lvl skrub", "1v1 bro", "why yew hax00r", "1337 git hacked lolz", "deal wit it", "too easy", "final killcam lel", "quickscoped newb", "#swag", "wrecked", "REPORTED!", "lvl?", "4/20 blaze it dewd"}
	sWidth = love.graphics.getWidth()
	sHeight = love.graphics.getHeight()
	xMid = sWidth / 2
	yMid = sHeight / 2
	warning = love.graphics.newImage("warning.png")
	bro = love.graphics.newImage("1v1bro.png")
	doritos = love.graphics.newImage("doritos.png")
	mtn = love.graphics.newImage("mtn.jpg")
	doge = love.graphics.newImage("doge.png")
	font = love.graphics.newFont("fill.ttf", 14)
	wonka = love.audio.newSource("wonka.mp3")
	bg = love.graphics.newImage("bg.jpg")
	kim = love.graphics.newImage("kim.png")
	gamestate = "warning"
	love.physics.setMeter(64)
	world = love.physics.newWorld(0, 9.81 * 64, true)
	local state = not love.mouse.isVisible()
	love.mouse.setVisible(state)

	

end


function love.draw()
	love.graphics.setColor(255, 255, 255)
	love.graphics.setFont(font)
	mx, my = love.mouse.getPosition()
	love.graphics.draw(doge, mx, my, 0, 1, 1, doge:getWidth(), doge:getHeight())
	if gamestate == "warning" then
		love.graphics.setColor(255, 255, 255)
		love.graphics.setBackgroundColor(255, 255, 255)
		love.graphics.draw(warning, 1, 1)
		
		love.graphics.rectangle("fill", xMid - 250, yMid - 55, 500, 220)
		love.graphics.setColor(0, 0, 0)
		love.graphics.rectangle("line", xMid - 250, yMid - 55, 500, 220)
		love.graphics.setNewFont(13)
		love.graphics.printf(warningtxt, xMid-247, yMid-55, 500, center)
		love.graphics.setColor(0, 0, 255)
		love.graphics.print("PRESS ENTER", xMid-45, yMid+130)
		
		love.graphics.setColor(255, 0, 0)
		love.graphics.rectangle("fill", xMid-130, yMid-275, 262, 50)
		love.graphics.setColor(0, 0, 0)
		love.graphics.rectangle("line", xMid-130, yMid-275, 262, 50)
		love.graphics.setNewFont(30)
		love.graphics.printf("C4rful m8", xMid-75, yMid-270, 260, center, r, sx, sy, ox, oy, kx, ky)
	
	elseif gamestate == "title" then
		love.graphics.setColor(255, 255, 255)
	 	love.graphics.setBackgroundColor(love.math.random(0, 255), love.math.random(0, 255), love.math.random(0, 255))
		love.graphics.draw(bro, xMid-250, yMid-200, 0, 1, 1, bro:getWidth() / 2, bro:getHeight() / 2)
		
			love.graphics.setNewFont(30)
			love.graphics.setColor(math.random(255), math.random(255), math.random(255))
			love.graphics.print(lel[math.random(#lel)], math.random(1,800), math.random(1, 600), math.random(90), 1, 1)
			love.graphics.draw(mtn, math.random(800), math.random(600), math.random(90), 1, 1)
			love.graphics.draw(doritos, math.random(800), math.random(600), math.random(90), 1, 1)
			love.graphics.draw(doge, math.random(800), math.random(600), math.random(90), 1, 1)
			love.graphics.setColor(math.random(255), math.random(255), math.random(255))
			love.graphics.rectangle("fill", xMid-250, yMid-100, 500, 200)
			love.graphics.setNewFont(45)
			love.graphics.setColor(255, 255, 255)
			love.graphics.print("SKRUB JUMP", xMid-140, yMid-60)
			love.graphics.setColor(math.random(255), math.random(255), math.random(255))
			love.graphics.print("PRESS ENTER", xMid-140, yMid-10, r, sx, sy, ox, oy, kx, ky)
			love.audio.play(wonka)
		elseif gamestate == "game" then
			--love.graphics.setBackgroundColor(love.math.random(0, 255), love.math.random(0, 255), love.math.random(0, 255))
			love.graphics.draw(doge, mx, my, 0, 1, 1, doge:getWidth(), doge:getHeight())
			love.audio.stop()
			love.graphics.draw(bg, 1, 1, r, sx, sy, ox, oy, kx, ky)
			love.graphics.draw(doge, mx, my, 0, 1, 1, doge:getWidth(), doge:getHeight())
			
			for i=1, #text do
				love.graphics.setColor(255, 255, 255, 255 - (i-1) * 6)
				love.graphics.print(text[#text-(i-1)], 10, i * 15)

				    love.graphics.setColor(255,255,255)
                    rect:draw('fill')
                    mouse:draw('fill')
            end
		end --end gamestate function
end

function love.update(dt)
	world:update(dt)

	mouse:setPosition(love.mouse.getPosition())

	rect:rotate(dt)
	Collider:update(dt)

	while #text > 40 do
		table.remove(text, 1)
	end
end

function love.focus(bool)
	if bool then
		print(gamestate) --helps with debugging menus
	end
end

function love.keypressed( key, unicode )
	
	if gamestate == "warning" and key == 'return' then
		gamestate = "title"
	elseif gamestate == "title" and key == "return" then
		gamestate = "game"

	end

end

function love.keyreleased( key, unicode )
end

function love.mousepressed( x, y, button )
end

function love.mousereleased( x, y, button )
end

function love.quit()

end
Thanks for the help in advance!
lelSkrub
Prole
Posts: 6
Joined: Fri Jan 09, 2015 2:27 am

Re: :Move To Error?

Post by lelSkrub »

Fixed it myself xD

Code: Select all

mouse:MoveTo()
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Gunroar:Cannon() and 4 guests