Getting C++ Runtime errors?

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
User avatar
Lua Hal
Citizen
Posts: 58
Joined: Tue Jul 12, 2011 10:30 pm

Getting C++ Runtime errors?

Post by Lua Hal »

Runtime Error!
Program: C:\Program Files\LOVE\love.exe


This application has requested the Runtime in an unusual way.
Please contact the application's support team for more information.
I get that error whenever I run:

Code: Select all

function draw(object,X,Y,rotation,flipx,flipy) --ENUM, number, number, number, bool, bool
height=object:getHeight()
width=object:getHeight()
love.graphics.draw(object, X + width/2, Y + height/2, math.rad(rotation), flipx and -1 or 1, flipy and -1 or 1, width/2, height/2)
end
function rite(str)
love.graphics.print(str,0,line*13)
line=line + 1
end
function loadentitydata()
npcs={}
love.filesystem.load("config.txt")()
end
function loadmap()
mapdata=love.image.newImageData("Map.png")
num=0
map = {}
for y = 1,mapdata:getHeight() do
	for x = 1,mapdata:getWidth() do
		r,g,b,a = mapdata:getPixel(x,y)
		if r == 255 and g == 128 and b == 0 then
		map[x..":"..y] = "lava"
		elseif r == 0 and g == 0 and b == 255 then
		map[x..":"..y] = "water"
		elseif r == 0 and g == 255 and b == 0 then
		map[x..":"..y] = "grass"
		elseif r == 156 and g == 90 and b == 60 then
		map[x..":"..y] = "dirt"
		elseif r == 100 and g == 100 and b == 100 then
		map[x..":"..y] = "stone"
		elseif r == 200 and g == 200 and b == 200 then
		map[x..":"..y] = "cobble"
		elseif r == 200 and g == 255 and b == 200 then
		map[x..":"..y] = "mcobble"
		elseif r == 0 and g == 100 and b == 0 then
		map[x..":"..y] = "slime"
		elseif r == 255 and g == 255 and b == 255 then
		map[x..":"..y] = "wood"
		end
	end
end
end
function love.load()
Character=love.graphics.newImage("Textures\/Sprite.png")
tiles={}
tiles["grass"]=love.graphics.newImage("Textures\/Grass.png")
tiles["lava"]=love.graphics.newImage("Textures\/Lava.png")
tiles["wood"]=love.graphics.newImage("Textures\/Planks.png")
tiles["water"]=love.graphics.newImage("Textures\/Water.png")
tiles["dirt"]=love.graphics.newImage("Textures\/Dirt.png")
tiles["slime"]=love.graphics.newImage("Textures\/Slime.png")
tiles["mcobble"]=love.graphics.newImage("Textures\/MossyCobble.png")
tiles["cobble"]=love.graphics.newImage("Textures\/Cobble.png")
loadmap()
loadentitydata()
game()
end
function game()
function love.draw()
love.graphics.print("Hi",0,0)
end
end
What's wrong? :shock:
User avatar
thelinx
The Strongest
Posts: 857
Joined: Fri Sep 26, 2008 3:56 pm
Location: Sweden

Re: Getting C++ Runtime errors?

Post by thelinx »

Try installing the Visual Studio 2008 runtimes.
User avatar
Lua Hal
Citizen
Posts: 58
Joined: Tue Jul 12, 2011 10:30 pm

Re: Getting C++ Runtime errors?

Post by Lua Hal »

Nope, didn't work. D:
User avatar
Boolsheet
Inner party member
Posts: 780
Joined: Wed Dec 29, 2010 4:57 am
Location: Switzerland

Re: Getting C++ Runtime errors?

Post by Boolsheet »

Valid x and y values for ImageData:setPixel() and ImageData:getPixel() start at 0 and go up to image width and height minus 1.
LÖVE 0.7.2 terminates if you get or set stuff out of range. That's changed for the next version.
Shallow indentations.
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Denver, CO
Contact:

Re: Getting C++ Runtime errors?

Post by TechnoCat »

Lua Hal.
ImageData pixel indices are integer values from [0,width) and [0,height). You are doing [1, width] and [1,height].
User avatar
Lua Hal
Citizen
Posts: 58
Joined: Tue Jul 12, 2011 10:30 pm

Re: Getting C++ Runtime errors?

Post by Lua Hal »

Boolsheet wrote:Valid x and y values for ImageData:setPixel() and ImageData:getPixel() start at 0 and go up to image width and height minus 1.
LÖVE 0.7.2 terminates if you get or set stuff out of range. That's changed for the next version.
TechnoCat wrote:Lua Hal.
ImageData pixel indices are integer values from [0,width) and [0,height). You are doing [1, width] and [1,height].
Thanks again guys!

Also:

My face when this works:
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 206 guests