[QUOTE=grlira;25833895]I'm working on getting familiar to XNA and currently have a LinkedList of renderable objects setup. The basic setup is
The update() function of the main game class goes trough each element and calls its update() method.
The draw() function of the main game class does the same, but calling draw() instead.
Now, I want the objects to be removed from the LinkedList if they go offscreen, and can't for the love of god get this to work (probably out of unfamiliarity with C#). Here's what I have:
[cpp]
//bla bla bla code
// we're in the update() function
foreach (RedBall redBall in RedBalls) { //RedBall is my renderable object, RedBalls is my LinkedList
if (redBall.getPos().Y > 300) { //300 hardcoded for testing purposes atm
RedBalls.Remove(redBall);
}
redBall.Update(gameTime);
}
// bla bla bla more code
[/cpp]
Now, what this does, is complain that "Collection was modified after the enumerator was instantiated".
I know what it means, but can't figure how to solve it. Any ideas?[/QUOTE]
Not sure with linked lists, but you could use a normal List<t> instead (removal is easier) or set a variable inside the redBall that flags it to be deleted later (and not used until then).
Also you'll want to put an else before that redBall.Update() otherwise it'll be updated even if it's removed from the collection.
[QUOTE=grlira;25833895]Also, dumb question, with XNA, how on earth do you get the dimensions (resolution) of the game window (or better even, the draw area)?[/QUOTE]
GraphicsDevice.PresentationParameters.BackBufferWidth and BackBufferHeight
[QUOTE=grlira;25833895]I'm working on getting familiar to XNA and currently have a LinkedList of renderable objects setup. The basic setup is
The update() function of the main game class goes trough each element and calls its update() method.
The draw() function of the main game class does the same, but calling draw() instead.
Now, I want the objects to be removed from the LinkedList if they go offscreen, and can't for the love of god get this to work (probably out of unfamiliarity with C#). Here's what I have:
[cpp]
//bla bla bla code
// we're in the update() function
foreach (RedBall redBall in RedBalls) { //RedBall is my renderable object, RedBalls is my LinkedList
if (redBall.getPos().Y > 300) { //300 hardcoded for testing purposes atm
RedBalls.Remove(redBall);
}
redBall.Update(gameTime);
}
// bla bla bla more code
[/cpp]
Now, what this does, is complain that "Collection was modified after the enumerator was instantiated".
I know what it means, but can't figure how to solve it. Any ideas?
Also, dumb question, with XNA, how on earth do you get the dimensions (resolution) of the game window (or better even, the draw area)?
thanks for any help[/QUOTE]
Gaphics.GraphicsDevice.Viewport.Height
or something similar, I forget.
[QUOTE=grlira;25833895]I'm working on getting familiar to XNA and currently have a LinkedList of renderable objects setup. The basic setup is
The update() function of the main game class goes trough each element and calls its update() method.
The draw() function of the main game class does the same, but calling draw() instead.
Now, I want the objects to be removed from the LinkedList if they go offscreen, and can't for the love of god get this to work (probably out of unfamiliarity with C#). Here's what I have:
[cpp]
//bla bla bla code
// we're in the update() function
foreach (RedBall redBall in RedBalls) { //RedBall is my renderable object, RedBalls is my LinkedList
if (redBall.getPos().Y > 300) { //300 hardcoded for testing purposes atm
RedBalls.Remove(redBall);
}
redBall.Update(gameTime);
}
// bla bla bla more code
[/cpp]
Now, what this does, is complain that "Collection was modified after the enumerator was instantiated".
I know what it means, but can't figure how to solve it. Any ideas?
thanks for any help[/QUOTE]
[cpp]
//bla bla bla code
// we're in the update() function
RedBall[] temp = RedBalls.ToArray();
foreach (RedBall redBall in temp) { //RedBall is my renderable object, RedBalls is my LinkedList
if (redBall.getPos().Y > 300) { //300 hardcoded for testing purposes atm
RedBalls.Remove(redBall);
continue;
}
redBall.Update(gameTime);
}
// bla bla bla more code
[/cpp]
You can't modify a collection while you're enumerating through it, easily solved by enumerating through a copy of the collection.
[QUOTE=Chris220;25832821]I rated you late, then looked up and realised that you even rated Jallen "agree"
I am now confused as to why you made that post :v:[/QUOTE]
I posted, scrolled up a little, saw Jallen's post, rated agree, refreshed to see if anyone noticed my silliness, saw you rated me late, cursed a little. :v:
I've been messing around. Working on a level up system for Zombie Outrage 2.
[img]http://i51.tinypic.com/2exnj11.jpg[/img]
By the way, the high scores reached the bottom. I took the screen shot before they could scroll up. ;)
[QUOTE=xAustechx;25835203]I've been messing around. Working on a level up system for Zombie Outrage 2.
[img_thumb]http://i51.tinypic.com/2exnj11.jpg[/img_thumb]
By the way, the high scores reached the bottom. I took the screen shot before they could scroll up. ;)[/QUOTE]
Eugh, ranking systems. Providing a higher rank doesn't come with any perks, it's all good.
Also, I'm not saying "You're ranking system sucks" Because, to be honest, actually pretty nifty.
[QUOTE=Loli;25835305]Eugh, ranking systems. Providing a higher rank doesn't come with any perks, it's all good.
Also, I'm not saying "You're ranking system sucks" Because, to be honest, actually pretty nifty.[/QUOTE]
Um... Thanks? XD
[QUOTE=xAustechx;25835203]I've been messing around. Working on a level up system for Zombie Outrage 2.
[img_thumb]http://i51.tinypic.com/2exnj11.jpg[/img_thumb]
By the way, the high scores reached the bottom. I took the screen shot before they could scroll up. ;)[/QUOTE]
Love to see how this is progressing, any chance of expanding on the multiplayer?
I'm thinking some sort of master server that each user made server queries with a heartbeat kind of thing.
[QUOTE=looped;25835407]Love to see how this is progressing, any chance of expanding on the multiplayer?
I'm thinking some sort of master server that each user made server queries with a heartbeat kind of thing.[/QUOTE]
Thanks. I'll try to work on multiplayer. But to be honest in case anyone couldn't tell, I've been kind of pushing that WAYYYY aside because networking like that is pretty challenging, at least for me.
At the moment I'm trying to get an [url="http://osu.ppy.sh/"]osu![/url] feel with my game. osu! is a music game that actually supports multiplayer, but it's not played nearly as often as single player because of the way he made his single player fun with scores and such.
But I'll see what I can do, and thanks for the feedback. :)
I finished my tile based movement system.
I'm working up towards a RPG engine, with enemies and combat and all that shit.
It's going to come in 3 flavors:
Rouge like: Turn based battle system on the map, tile based movement.
New Combat: Like rouge like, except with the combat on another screen (Think final fantasy, dragon quest, Pokemon etc.)
Action:Pixel based movement, live real time action battle system. This is the one I'll be working most on.
Mwahaha
[IMG]http://i55.tinypic.com/zls0gz.jpg[/IMG]
Thats the end of me spamming my lighting
whats a good 2d game engine, thats very open.
[QUOTE=dechristian;25836966]whats a good 2d game engine, thats very open.[/QUOTE]
Language preferences?
[QUOTE=Icedshot;25836814]Mwahaha
[img_thumb]http://i55.tinypic.com/zls0gz.jpg[/img_thumb]
Thats the end of me spamming my lighting[/QUOTE]
Nice, are you going to release your code? I have always been interested in how people do lighting.
Open as in you code not just place pre-made stuff
[QUOTE=dechristian;25837209]Open as in you code not just place pre-made stuff[/QUOTE]
???
What language? C++, C#, Java...
[QUOTE=dechristian;25837209]Open as in you code not just place pre-made stuff[/QUOTE]
What?
[QUOTE=Liquid Helium;25837089]Nice, are you going to release your code? I have always been interested in how people do lighting.[/QUOTE]
[url]http://www.gamedev.net/reference/programming/features/2dsoftshadow/[/url]
:)
[QUOTE=Liquid Helium;25837089]Nice, are you going to release your code? I have always been interested in how people do lighting.[/QUOTE]
Sure, though bear in mind thats its perhaps inefficiently coded, and probably extremely badly at that
[url]http://dl.dropbox.com/u/9317774/Lighting.rar[/url]
Still need to merge the lighting into one function for the light class, and implementation files in the distant future probably. Oh and add support for more or less than 4 sided shapes. And make light magnitude do something!
[QUOTE=dechristian;25837209]Open as in you code not just place pre-made stuff[/QUOTE]
When I where the why on what do so I can the whole tortia
A 2d game engine that isn't one of those click and drop games. I don't know C#,C++ or Java but i guess java if there is one...
[QUOTE=Liquid Helium;25837089]Nice, are you going to release your code? I have always been interested in how people do lighting.[/QUOTE]
[url=http://pastebin.com/sSF9Fjs6]Here[/url]'s an example in Lua.
What do you know then?
[QUOTE=Overv;25837469][url=http://pastebin.com/sSF9Fjs6]Here[/url]'s an example in Lua.[/QUOTE]
[QUOTE=ZeekyHBomb;25837342][url]http://www.gamedev.net/reference/programming/features/2dsoftshadow/[/url]
:)[/QUOTE]
Cheers guys.
[QUOTE=dechristian;25837438]A 2d game engine that isn't one of those click and drop games. I don't know C#,C++ or Java but i guess java if there is one...[/QUOTE]
If you're going for Java, I'd recommend Slick. It's built off of lwjgl, which is one of the the two most popular openGL wrappers for Java. Although, if you don't know Java (or any of those other languages), I'd try to learn the language first, before making a game.
[QUOTE=Icedshot;25833238]Just spotted your pm, no idea if my reply has worked[/QUOTE]
i answered your PM
I've been working on a Bandcamp downloader for the past few days. Unfortunately GUI in Java is a huge pain in the ass requiring the extending of many classes in order to achieve a look that you desire.
Anyways, this is the start of it:
[img]http://anyhub.net/file/bandcamp_gui.png[/img]
That looks nice ander. :D
I know you guys are getting tired of seeing this on the waywo by now, so I'll put it in a media tag.
[media]http://i56.tinypic.com/300wrwl.jpg[/media]
Tried making a little user browser for Zombie Outrage 2.
[img]http://dl.dropbox.com/u/4838268/cube.png[/img]
Still need to fix AA
Its loading my own binary format, I still have to figure out why it wont load the teapot properly
[QUOTE=xAustechx;25841564]That looks nice ander. :D
I know you guys are getting tired of seeing this on the waywo by now, so I'll put it in a media tag.
[media]http://i56.tinypic.com/300wrwl.jpg[/media]
Tried making a little user browser for Zombie Outrage 2.[/QUOTE]
Please incorporate the menu screen that was designed a couple pages back
Sorry, you need to Log In to post a reply to this thread.