can you post the entire error and point out which line the error occurs on
asdfghjkl;
I had pointed it out, but I remade my post.
tilesetBatch:addq( tileQuads[map.region[x][y]], x * tileSize / 2, y * tileSize / 2 ) is the line.
[code]
tileView = 32 -- how many tiles shown on-screen (height and width)
tileSize = 16 -- size of tiles, height and width
function updateBatch()
tilesetBatch:clear()
for x = 1, tileView - 1 do
for y = 1, tileView - 1 do
tilesetBatch:addq( tileQuads[map.region[x][y]], x * tileSize / 2, y * tileSize / 2 )
end
end
end[/code]
It seems to think that map.region[x][y] is nil.
[code]for x = 1, sizeX do
for y = 1, sizeY do
if ( map.elevation[x][y] >= map.level ) then
map.region[x][y] = 1
else
map.region[x][y] = 0
end
end
end[/code]
throw a print() right beneath the lines where you set map.region[x][y] and make sure it's being called, and at the end of your for loop (the one in the above snippet where you loop through sizeX) print the map.region table, then loop through it and print each of the sub-tables (i.e. PrintTable(map.region), loop through map.region and PrintTable(map.region[i]))
Yeah, map.region is always nil for some reason.
[editline]14th March 2012[/editline]
Although I can grab the region number without hassle when I want to just display it in the draw loop.
so are the print() calls below map.region[x][y] = 1 being called or not?
The print below is getting called, yeah.
Not outside the function, except when in the draw function. It's fucking weird.
I'm just going to scrap it and start over. Not much hassle, I suppose.
im confused :(
so the print below "map.region[x][y] = 1" is being called, which means that the value is being set, but as soon as the loop is over map.region becomes nil, even though we just set it's value?
OHHH wait dont scrap it i think i know whats wrong, you have to define map.region[x] as a table before you give it any values, so what you need to do it change it to this
[code]
for x = 1, sizeX do
for y = 1, sizeY do
if ( map.elevation[x][y] >= map.level ) then
map.region[x] = {}
map.region[x][y] = 1
else
map.region[x] = {}
map.region[x][y] = 0
end
end
end
[/code]
But I do define map.region[x] earlier. :c
[code]
map.elevation = {}
map.region = {}
for i = 1, sizeX do map.elevation[i] = {} end
for i = 1, sizeX do map.region[i] = {} end
[/code]
That's right above my two loops to establish elevation and region.
My code is really messy anyway. Scrapping is more or less cleaning up.
and here i was feeling helpful
Well I fixed it. Not entirely sure how. Cleaning my code got it working at least.
Alright so I'm trying to draw a semitransparent sphere, and for some reason, it's working, but only from one direction:
[img]http://dl.dropbox.com/u/39921754/sphere6.png[/img]
The light blue side is semitransparent, the other side is completely opaque. Which is weird, because it does seem to be blending with the background; the lower the alpha value I supply, the darker it gets, but it's still opaque from one direction.
Note that this picture is from the side of the object. If I look directly from the front, it's completely opaque, and from the behind, it's semitransparent.
I've tried a few different things like reversing the winding, telling it to render both sides, etc, but nothing works. I use GL_QUAD_STRIP to draw the sphere, if that helps. If you need the sphere drawing code, I'll post it.
I need to split up a mesh into rectangles of 'up to' an arbitrary size. By this I mean there is a maximum size for each rectangle (say 2 by 2), but they can be smaller than this (they don't need to be square either).
[img]http://i.imgur.com/leUD4.png[/img]
(numbers are vert indices)
I have the list of verts, mesh_rows, mesh_columns and the width/height of each square. It doesn't need to be quick, but ideally I need to get the following:
for each square:
-a list of vert indices
-number of columns of verts
-number of rows of verts
Anyone have any ideas?
Need some help with my player's collisions.. I've got a player (size 28x48) and a tile-based map consisting of 32x32 blocks. (Sidescroller, so there's gravity.) I've made some successful code for the collisions, but now I've got trouble with implementing platforms (blocks that only have collisions on top) and some other tiny problems. I want to rewrite my code, but because this is like the 5th time, I'd like to see a good example of how to do this. Anyone got some useful stuff?
I'm trying to create a C# project using LibUsbDotNet to create an interface for a USB robotic arm I own. I've installed the downloadable package from [url]http://sourceforge.net/projects/libusbdotnet/[/url] (the green download button on that page).
I started up Visual C# 2010 Express and made a new project, but now I'm stuck mumbling over how I should go about enabling the use of LibUsbDotNet in my project. I have no idea where to start or what to do.
Can anybody help me?
-snip-
[QUOTE=NovembrDobby;35137744]I need to split up a mesh into rectangles of 'up to' an arbitrary size. By this I mean there is a maximum size for each rectangle (say 2 by 2), but they can be smaller than this (they don't need to be square either).
[img]http://i.imgur.com/leUD4.png[/img]
(numbers are vert indices)
I have the list of verts, mesh_rows, mesh_columns and the width/height of each square. It doesn't need to be quick, but ideally I need to get the following:
for each square:
-a list of vert indices
-number of columns of verts
-number of rows of verts
Anyone have any ideas?[/QUOTE]
Uh:
[cpp]
for (int x = 0; x < num_columns-1; x += rect_w) {
for (int y = 0; y < num_rows-1; y += rect_h) {
x0 = x;
y0 = y;
x1 = x + rect_w >= num_columns ? num_columns : x + rect_w;
y1 = y + rect_h >= num_rows ? num_rows : y + rect_h;
rect = {
verts[x0, y0],
verts[x0, y1],
verts[x1, y1],
verts[x1, y0]
};
rects.push(rect);
}
}
[/cpp]
(No specific syntax, convert to the language of your choice)
Thanks, but I already sorted it. The hard part was getting the correct indices to use inside the rectangle - the edges were easy to figure out.
I am working on a re make of slime volleyball, except I have no idea how the physics works of the ball bouncing off the slimes. Any tips?
[QUOTE=ryandaniels;35136552]Alright so I'm trying to draw a semitransparent sphere, and for some reason, it's working, but only from one direction:
[img]http://dl.dropbox.com/u/39921754/sphere6.png[/img]
The light blue side is semitransparent, the other side is completely opaque. Which is weird, because it does seem to be blending with the background; the lower the alpha value I supply, the darker it gets, but it's still opaque from one direction.
Note that this picture is from the side of the object. If I look directly from the front, it's completely opaque, and from the behind, it's semitransparent.
I've tried a few different things like reversing the winding, telling it to render both sides, etc, but nothing works. I use GL_QUAD_STRIP to draw the sphere, if that helps. If you need the sphere drawing code, I'll post it.[/QUOTE]
I figured this out; it was simply a matter of the polygons in the front being rendered first, and therefore occluding the transparency of the polygons behind it. It just so happened that my object were also lined up first to last, causing it to seem as though the problem was something to do with the angle I was looking, rather than the order in which things were being drawn.
I think I've decided against using transparency for now, because any way I handle this, I have to sort the spheres every frame, based on their distance from the user. Which may be entirely possible, but is way to much work for a unnecessary effect (at least this early in development).
But here is a screenshot of it working
[img]http://dl.dropbox.com/u/39921754/sphere7.png[/img]
Could someone with SVN upload the latest version of the Gwen source please? I dont want to install SVN just to download the one project.
Just get the svn exes and "svn checkout <url> <destination>"
[editline]14th March 2012[/editline]
Why not just get turtoise svn? You'll need it more than once, chances are.
Ok so I got silkSVN and downloaded gwen but it fails to compile with mingw32-make, something in the Anim.cpp file
[QUOTE=TerabyteS_;35139491]I'm trying to create a C# project using LibUsbDotNet to create an interface for a USB robotic arm I own. I've installed the downloadable package from [url]http://sourceforge.net/projects/libusbdotnet/[/url] (the green download button on that page).
I started up Visual C# 2010 Express and made a new project, but now I'm stuck mumbling over how I should go about enabling the use of LibUsbDotNet in my project. I have no idea where to start or what to do.
Can anybody help me?[/QUOTE]
There seems to be a lot of documentation here with example code :
[URL="http://libusbdotnet.sourceforge.net/V2/Index.html"]http://libusbdotnet.sourceforge.net/V2/Index.html[/URL]
When I implicitly convert a list to an String in C#, it just comes back like this, without the data
[code]System.Collections.Generic.List`1[System.Int32][/code]
How can I get the actual data from the list?
I have sql homework i cant do
The first table is
Director table
(dir, dirname, country)
the second is
Movie table
(movie, movname, length, year, dir)
this is the question and my answer so far
7. List any movies by a director that are the same length in time.
SELECT movname, length, A.dir, dirname
FROM movie A, director
WHERE length=length
GROUP BY director.dir
Is that how I should do it? I don't have the sever program with me and I'm supposed to do it by hand
[QUOTE=Mr. Smartass;35145908]When I implicitly convert a list to an int in C#, it just comes back like this, without the data
[code]System.Collections.Generic.List`1[System.Int32][/code]
How can I get the actual data from the list?[/QUOTE]
A list to an int? Not sure what you mean.
[QUOTE=evil-tedoz;35144124]There seems to be a lot of documentation here with example code :
[URL="http://libusbdotnet.sourceforge.net/V2/Index.html"]http://libusbdotnet.sourceforge.net/V2/Index.html[/URL][/QUOTE]
It doesn't say how to set up VC# 2010 Express to use it
[QUOTE=Mr. Smartass;35145908]When I implicitly convert a list to an int in C#, it just comes back like this, without the data
[code]System.Collections.Generic.List`1[System.Int32][/code]
How can I get the actual data from the list?[/QUOTE]
little hint: (you do the same with arrays)
[code]int index = 0; //this will makes sure you get the first item
int data = yourList[index]; //data now contains the first item's value[/code]
[QUOTE=TerabyteS_;35148365]It doesn't say how to set up VC# 2010 Express to use it[/QUOTE]
[url]http://msdn.microsoft.com/en-us/library/7314433t%28v=vs.90%29.aspx[/url]
[QUOTE=NovembrDobby;35147793]A list to an int? Not sure what you mean.[/QUOTE]
Whups, meant list to a string
My bad
Sorry, you need to Log In to post a reply to this thread.