Showing posts with label removeall. Show all posts
Showing posts with label removeall. Show all posts

Thursday, March 18, 2010

Smart Bomb effect

Above is what i am currently coding. The effect or one of them for one of my smart bomb types. In the shooter for my next XBLIG game you will have a secondary weapon. This is going to be smart bombs. Each smart bomb type will have it's own, special way of helping you out. This smart bomb effect is for general smarty pants bomb. One that just clears the screen of enemy bullets. Of course it would be boring to just make them disappear. Soooo i came up with an idea.

In the first picture you see i have set off my smart bomb and then moved out of frame. The effect is that i have  abunch of line go from my ship at time of activation and hit each bullet on the screen. Then after a second they all disappear. Oh, and for that second the bullets are stopped in their tracks. But are still dangerous !

Here in this second picture you see me just moved left from when i fired the shot. It is a picture of the 4th level bosses bullets, and i think ti loks quite cool. One downside is if this effect is fired off with not a lot of bullets it looks crap. However it looks it's best if you are surrounded as you may have noticed.

I just had to include this third picture. Generally i still thinkn that if all th ebullets are on one side it wdoes not look as good as when you are surrounded. But man, that looks cool, hitting all those streaming bullets from the boss.

So my next task is to make this effect look better in all situations, for that i am going to include some dummy lines in each of the cardinal positions, we shall see if that helps or not.

Finally i need to actually make the lines fade out, but for that i have to rewrite the list iterator code, so it can wait :D

laters

Wednesday, March 17, 2010

Lists in C# and RemoveAll

So there i am last night, working diligently on the Roundline class. A lovely thing, though i really need to rewrite it's simplified functionality. Well that was sort of what i was doing. Adding in more controls etc.

I am going to use variable width lines for one of my smart bombs for the new shooter. This should look great if i can possibly do it. Adding in the variable width functionality is also priceless as far as adding in Tech to my rather small tech that i use for writing my games. Gameplay shouldn't need tech, but eye candy does.

So all i wanted to do was attach a bunch of lines to each smart bomb explosion. simple enough, but then they need to all die at the correct time. so i added in an ID to the line class. I thought that removal from a list would be so easy. Just for Each loop thru the list and remove them as i go. This is not so easy, oooh no! So upon research on the web i found Removeall. This is exactly what i needed, then a single command would allow me to remove all the list itmes that were corresponding to my ID. Well what a pain. Yep, i have to say that it took me an hour of reading and trying to get the SINGLE line of code to compile. though once it did, it worked a treat.

So lists... hmm,. I usually use arrays for everything and control numbers of stuff etc with Defines. I never ever make stuff grow and shrink. I have seen the horrors this does to memory fragmentation etc. I also know that allocating and deallocating memory is soo freakin slow. So i don't do it. But it seems like i need to learn lists. Just so i know what i am talking about.

BTW: my problems with messing badly with memory come from 26 years of experience, most on machine that had a fraction of the memory of that handy usb pen drive you have on your key ring.

laters