Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / DNG - Space Invaders

Author
Message
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 13th Aug 2010 23:33
Well like I said, I am legally stuck in a room until I get called into a big room to see if I can serve on a jury. So I am pretty much here all day today (don't know about your timezone, but its only 13:28 here so I've got tons of time).

Re. the programming stuff, give it a shot. We're here to help you out. That's the point of DarkNoobs .

Here is the method I would suggest for you:

1)Grab a notebook/piece of paper and pencil
2)Sketch what you want it to look like (it helps to visualize it and have it right there in front of you)
3)COMMENT TIME!!!! Write in the program all in comments what you want to do
4) Break it down. Take the points you just REM'd in and comment in sub points, breaking down each main point into smaller ones. If you hit a challenging one that you can't quite figure out how to approach, that's what we're here for.
5)Once everything is broken down into its simplest form, start your coding. Get your framework out first. Initialize some variables, get your FOR-NEXT, REPEAT-UNTIL, and WHILE-ENDWHILE loops all setup so that all you need is to put in the mechanics. Sometimes it helps to build this INTO your comment block (so that the comments about things that will be looped are contained within the loops themselves)
6)Test at every significant change. Make sure the code you are working on is modular enough that you can turn everything off that is unnecessary (no need for aliens, players, shooting, moving).
7)By testing often, you can see when things start to break down and you can adjust the code as necessary.

Good luck!

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Shadow000
13
Years of Service
User Offline
Joined: 31st Jul 2010
Location:
Posted: 14th Aug 2010 11:06 Edited at: 14th Aug 2010 11:07
My problem is that most of the time, I just don't know the CODE to use to implement that stuff in my game. I read through the commands at DBpro help, but it seems that if I don't have them printed with descriptions, there's no way for me to remember...

Edit: remember...

I could rem out some commands and learn them. See you in the afternoon... based on my timezone.



Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 14th Aug 2010 12:24 Edited at: 14th Aug 2010 12:50
Only with practice will you learn which commands are best to use for different problems. The first thing you should try to distinguish is what kind of loop you should use. It's all about noticing patterns and similarities that you can exploit to make your code more efficient. Every time you write a program, look at your code and try to spot patterns and similar statements.
Say I wanted to print a shopping list on screen, I might start out with this:

I've repeated the same command a lot so we know there is a way to cut down the code. Another problem we have with this code is the data isn't being stored anywhere so we can't do anything with it, once it's printed to screen it is gone! Recognizing these problems is more important than knowing the solution; if you find problems you will seek out the solutions. If you posted that code on the forum you'd soon be told about arrays, then you can go off and learn how to use them. Let's say we came back with this code.

Now it's much more versatile; we could do things like sort the list into alphabetical order if we wanted to, and we can print items from the list whenever we want, not only once like before.
If you still sense that these lines are too similar then you are getting the hang of it.
What is different about each line? The numbers and the strings. When numbers are the only difference between statements, and if they count upwards, we can use a for loop to replace the old code. If we use data statements we can read one string after the other into the array.

The more you use things like arrays and for loops, you'll get idea of when they should be used. Always look at your code and think how it could be improved. Looking at other people's code is a great way to learn because you see code in action and you'll find some new tricks and solutions to problems that you didn't know about. I was using arrays for about a year before I saw the point of using data statements to fill them, and it took me several years to understand how to use functions.

BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 15th Aug 2010 01:24
Quote: "it took me several years to understand how to use functions"


I second that. It really wasn't until last year or the year before (after about 4-5 years of programming in DBC) that I finally understood functions. And even then, it wasn't because I read something or it was explained to me, I just tried it out. I started with an example and built upon it. Once I started to get the hang of it, I began to experiment and ended up going a bit overboard (somethings are better as subroutines, others as functions, as I learned).

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 15th Aug 2010 22:01
So quick question for everyone. There hasn't been a post in almost a full day. Where is everyone at? What is everyone working on? Are you stuck and in need of assistance?

Just don't want to see this fizzle.

If you consider yourself done (ie your code works). Post it, it will be evaluated, and if it doesn't have any SERIOUS problems (I would classify serious problems as having too many loops, severe bugs, framerate issues, not working, goto's, 0 comments, and a few others I can't think of) then its done. If it DOES have some issues, we will point out what it is, try our best to explain it, and its back to the drawing board.

Sorta on that topic, sorry for being kinda short with you on the whole goto thing, its just that its been hashed out time and time again on these forums and I wasn't having a great day.

While yes, goto's can be a way of getting something done, and sometimes it appears to be the easiest and cleanest way to do it, if you have coded yourself into that hole, perhaps you should look at how to do it without the goto's. Can you re-design your loops? Perhaps use a subroutine somewhere that would clear it up? Typically re-designing the structure and flow of your code will also help clear up potential bugs.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
AJAtom
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location:
Posted: 15th Aug 2010 22:15
um, I'm just waiting for my next assignment.
I already posted my code, 2 of my posts up I think

Eminent
13
Years of Service
User Offline
Joined: 15th Jul 2010
Location:
Posted: 15th Aug 2010 23:12
Ive been working on 3ds max and figuring out the animation thing.


BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 15th Aug 2010 23:22 Edited at: 15th Aug 2010 23:25
@Aj
Curious, what build of DBPro are you using? I get a syntax error when you use the INK command because you didn't include a background color, just a foreground color. Probably worth putting a ",0" at the end to increase compatibility.

Code looks pretty good though. Until obese comes in with a new assignment I have a challenge for you. Make the Alien movement smooth without significant recoding (The program should still THINK the same, just display differently).

@Eminent
3ds max? Your own thing or for the project? If for the project, how so? Just for making graphics or.....?

And to beat a dead horse, the animation concept is relatively simple. Its just like a movie. Movies aren't actual MOVEMENT, but rather, a bunch of images that are changed really fast to make it LOOK like movement. Think of the sprite as the TV that can display any picture you want. To create an animation, you just have to change the picture, not the TV.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Eminent
13
Years of Service
User Offline
Joined: 15th Jul 2010
Location:
Posted: 16th Aug 2010 00:35
Own thing. And incase DarkNoobs ever makes a 3d project.


AJAtom
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location:
Posted: 16th Aug 2010 00:39 Edited at: 16th Aug 2010 00:40
Wait BN2, this test, you want the aliens to move in an un-gridlike pattern?

well here it is:



All I had to do was edit some if-thens and some loopcounter variables.

Also it seems that I dont get an error when I use ink without the second parameter right after a create bitmap command. I have the latest DBPro

also , I'd just like to share
at the time I was listening to Radio/Video at 3:00 of the song, and I burst out laughing for some reason , ah I need sleep

BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 16th Aug 2010 00:42
Not bad, though did you notice that they get faster and faster as they drop a line?

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
AJAtom
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location:
Posted: 16th Aug 2010 00:59
yeah, Obese said they have to get faster every time they drop a line.
I do so by changing the alienspeed variable

Its going pretty fast though because alienspeed has to be an interger for it to work in the

sprite enemy,x+alienspeed,y,1

command

Daygamer
14
Years of Service
User Offline
Joined: 16th Mar 2010
Location: United States
Posted: 16th Aug 2010 01:17
@BN2
Here's my code. I've got a version with sprites too if you want it.




Quote: "Just don't want to see this fizzle."


Thanks for pushing this project along.

Coding is just better with music
God Bless!
Sepnon
14
Years of Service
User Offline
Joined: 7th Feb 2010
Location: Brazil
Posted: 16th Aug 2010 02:21
i can give my code from the competition, if anyone wants..
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 16th Aug 2010 02:25
@Daygamer

Had a weird issue when running your code where the player would stretch until I pressed space (wasn't always, just something that would happen every few seconds). I fixed it by adding BACKDROP ON right before the main loop.

I suggest combining the 2 versions of the code. Use a subroutine to load the images for the sprite and have a subroutine that just draws them and uses GET IMAGE to get the images for the sprites (so that its easily redistributable). That way, all the code is in a single file and when we want the media to be compiled, we just change the subroutine call at the beginning to load the images, rather than draw them.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Eminent
13
Years of Service
User Offline
Joined: 15th Jul 2010
Location:
Posted: 16th Aug 2010 03:30
Sepnon do you have an uncompressed version for the animations?


Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 16th Aug 2010 03:34
Quote: "yeah, Obese said they have to get faster every time they drop a line.
I do so by changing the alienspeed variable

Its going pretty fast though because alienspeed has to be an interger for it to work in the"


Just a note: Legend has it that the original space invaders got faster as more and more aliens were destroyed. It actually had to do with the hardware performance of the day. The game actually ran at one rate but as there were less and less aliens to redraw, the overall performance improved. Instead of correcting the speed, the original designer left it as is because it added a cool game challenge.

Though modern machines are a 1000 times faster, you may see a similar response if no syncing was used... but that's just a guess

Enjoy your day.
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 16th Aug 2010 04:45
@Sepnon

We appreciate it, but that kind of defeats the purpose of the project (to help those new to programming learn through the process of creating a game).

@Eminent
I have some pics I used for my space invaders clone I have been working on. I posted the alien one here to give you an idea of the animation.

Explanation:
4 stages of alien existence: Exploding (only for short time after getting killed--note this was one of the LAST parts I added), Level 1 (Easiest, requires 1 shot to kill), Level 2(medium, requires 2 shots to kill), Level 3(hard, requires 3 shots to kill).

I used the same pic and just recolored it so that I could easily have it go from Level 3 to Level 2 then Level 1 as it got shot.

The top row is frame one of the animation. The bottom row is frame 2 of the animation. The difference is subtle (the arm things go up and down) but enough to give the right effect (2 frames doesn't give you much to work with but is a good exercise when you are just starting out).

You can use this to experiment with/base yours off of.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose

Attachments

Login to view attachments
AJAtom
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location:
Posted: 16th Aug 2010 05:38
you're aliens are so cute BN2


also thanks for the trivia latch

Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 16th Aug 2010 11:47
Quote: "yeah, Obese said they have to get faster every time they drop a line.
I do so by changing the alienspeed variable

Its going pretty fast though because alienspeed has to be an integer for it to work in the

sprite enemy,x+alienspeed,y,1"

Using a float should work fine, it should just round it off.

Quote: "Just a note: Legend has it that the original space invaders got faster as more and more aliens were destroyed. It actually had to do with the hardware performance of the day. The game actually ran at one rate but as there were less and less aliens to redraw, the overall performance improved. Instead of correcting the speed, the original designer left it as is because it added a cool game challenge."

That is what I was thinking but the clone I played did it by line.
I like the idea of them getting faster the fewer there is, could you edit your code AJ so it works like that?

I have to go now but I'll be back later to look at what we have so far and give new jobs.

Daygamer
14
Years of Service
User Offline
Joined: 16th Mar 2010
Location: United States
Posted: 16th Aug 2010 18:14
@BN2, You mean something like this:





Coding is just better with music
God Bless!
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 17th Aug 2010 01:36
@Daygamer

Yeah, like that, but also have a subroutine that you could call instead of load_sprites that would draw them with standard drawing commands and then use GET IMAGE to make them useable.

Just a thought. That way you can distribute one program instead of 2. It can be tested anywhere with the draw_sprites subroutine (or similar name) and then once its time for final implementation, you can just erase the subroutine call and have it call load_sprites instead.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
AJAtom
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location:
Posted: 17th Aug 2010 07:40
anyone know what Shadow has been up to?

BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 18th Aug 2010 04:27
Quote: "anyone know what Shadow has been up to?"


Hmmm good question. He said to give him a few days to finish his thing a few days ago.

@Shadow
How's it going? Hitting any snags?

@Obese
Any word on the next batch of jobs?

I am available to help in compiling the code into one single source file if necessary, just let me know.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Sepnon
14
Years of Service
User Offline
Joined: 7th Feb 2010
Location: Brazil
Posted: 18th Aug 2010 22:16
@BN2
hmm.. you're right
anyways, i can help

Quote: "Just a note: Legend has it that the original space invaders got faster as more and more aliens were destroyed. It actually had to do with the hardware performance of the day. The game actually ran at one rate but as there were less and less aliens to redraw, the overall performance improved. Instead of correcting the speed, the original designer left it as is because it added a cool game challenge."


yep, i had a great idea to use that without speed vars
why not moving N aliens each loop?
think, that will speed up the aliens when one is killed, with a perfect precision without using floats, and some aliens will move first, just like the original

ooh man i wanted that challenge so bad.. i went kinda mad, i lost because of my char count D:
if i removed the menu and just put the game, i could win
ok, stopped
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 19th Aug 2010 03:19
Quote: "yep, i had a great idea to use that without speed vars
why not moving N aliens each loop?"

That is a good idea Sepnon, technically it would be moving -N aliens as in speed = maxspeed - N aliens. Is -N valid shorthand? I just made it up but it implies negative correlation.

@Team
Sorry I haven't gotten back to you with new jobs, it is too late tonight but I have tomorrow free so I will try to put everything together and see where we go next. BN2 if you're around I will post up the code for you to look at and test.

Sepnon
14
Years of Service
User Offline
Joined: 7th Feb 2010
Location: Brazil
Posted: 19th Aug 2010 03:58
something like this:




OBS: this code does nothing, dont run it, just read
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 19th Aug 2010 07:39
Quote: "BN2 if you're around I will post up the code for you to look at and test.
"


I'm free till saturday afternoon. Just let me know exactly what you want me to look for (criteria for sending back for further development prior to final integration).

Ex criterion:
-Not modular enough. If I have to add any significant amount of code to make it mesh.

-Not enough comments. If I don't know what a section does, it gets sent back for improvement by the writer.

Can't think of any more, but that kinda thing.

Or should I just compile and, as long as the code works as intended, make it work.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
AJAtom
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location:
Posted: 20th Aug 2010 02:45
well I started fooling around with enemy collision, and ive run into a little snag.

It seems no matter what alien I shoot at only aliens in the top and third row get deleted...working on solution

BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 20th Aug 2010 02:54
With more info we could help you out. Code is good, especially if it is well commented.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
AJAtom
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location:
Posted: 20th Aug 2010 03:40
its basically the same code but with



added after the "enemies get drawn" routine.
Also a simple sprite 1,mousex(),mousey(),1 is added in the main loop before the "enemyprops" subroutine is called.

Daygamer
14
Years of Service
User Offline
Joined: 16th Mar 2010
Location: United States
Posted: 20th Aug 2010 05:52 Edited at: 20th Aug 2010 05:52
@BN2

K, I've put a switch at the start of the program that will turn the sprites off and on. does that work?



Coding is just better with music
God Bless!
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 20th Aug 2010 06:07
@daygamer

Excellent.

The last thing you want to do with your code before declaring it done is package it. By that I mean take EVERYTHING in the loop, and put it into a subroutine called: control_player

Also, Obese's skeleton calls for a subroutine called update_bullets so you may need to go through your code and update label names. Obese's loop provides NO conditions for entering each subroutine, so make sure checks (like to see if the bullet exists for instance) are done INSIDE the subroutine, rather than before the call of it.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Daygamer
14
Years of Service
User Offline
Joined: 16th Mar 2010
Location: United States
Posted: 20th Aug 2010 17:41
Alright, cool. I work that out when I get a chance.

Please don't forget to look at AJAtom's problem. I didn't mean to steal the help up there.

Coding is just better with music
God Bless!
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 20th Aug 2010 23:28
@Aj
I've been trying to place your small segment into the more full code but I can't quite place where it goes.

Could you post the whole subroutine (whole code could help as well as I predict it to be a slightly elusive bug)

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
AJAtom
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location:
Posted: 21st Aug 2010 00:07 Edited at: 21st Aug 2010 00:09
the change is within the asterisks



I also tried to experiment with finding a way to find the farthest right alien.
I placed my attempt into the for next loop under the header variables right beside the alieny=sprite y(enemy) command.

BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 21st Aug 2010 00:48
Alright

Things here:
if sprite x(2)<=0+sprite width(enemy) and enemydir=-1

This is bad. Why? What if sprite 2 is killed? Your program will crash. Solution: Use the left most alien.

if sprite collision(1,enemy)=1 and mouseclick()=1 and handonmouse=0

If I am reading your code correctly that you posted before, sprite 1 is an alien sprite that is cloned.

So, why are you checking for collision with it?


Couple ways to find the alien extremes based on how you draw them.

1. If your creation method is Left->Right Top->Bottom, then simply checking if enemy+some number exists won't work because if enemy IS on the right, and one more than him exists, that means that enemy+1 is on the left follow? So what you would want to do is check your aliens going up or down the COLUMNS from right to left (or left to right to find the left most extreme).

The best way to accomplish this is with an array that stores all the aliens alive/dead state. I would suggest: Aliens(X,Y) or something similar. By using an array with several dimensions, you can just use a FOR-NEXT loop to scan through the column, rather than the rows. Follow?

2. If your creation method was Top->Bottom Right->Left, then you simply would have to check what the highest (for the right) and lowest (for the left) sprites are that exist.


2 would be the easiest from the start, but by looks of your code it would require the most code rework.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Daygamer
14
Years of Service
User Offline
Joined: 16th Mar 2010
Location: United States
Posted: 21st Aug 2010 16:36
@BN2

I've attempted to package my code. I think I may still be a little confused.

Should everything command be inside a subroutine.

Also can I still have subroutines other than player_movement and update_bullets. For example: draw_sprites



Coding is just better with music
God Bless!
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 21st Aug 2010 18:05
@Daygamer

I've marked the lines for deletion with #.
We don't want a cls in there because that's a display command and should be only in the display sub.
I see what you're doing with the sprites_on flag but if there are no images ready simple images will be generated as placeholders and used in sprites so the program will be the same.

You need to add in this sub the firing bullets code. It should check if there is a player bullet in existence (only one at a time) and if there's no bullet and the player presses spacebar fire a bullet. All you need to fire a bullet is to set the bullet xy to the gun position (there is a slight problem with this, can you see it?) and make a flag called player_bullet or something that is 1 when a player bullet exists.
Use that switch I showed you so the player can't hold down space for continuous firing.

Ah, I see you have put the code in the update_bullet sub, that's the wrong place; update_bullet is a processing sub, it's a number cruncher, all input commands should be in the input sub control_player.

I see you've thought of continuous firing, and the problem with positioning the bullet on the player (it would count as a hit on the player).
Your fire_lock is not as neat as the switch I showed earlier.

Just a small tip before I add that, when you check a variable in a condition and inside the condition that variable is changed it is often wise to put the change on the first line inside the condition so we can quickly see the effect


Here's your coontrol_player code with my tweaks

I changed the flag name to bullet_fired because fire_bullet sounds like an instruction to fire a bullet instead of show that one has been fired.

Here's your update bullet code

This will work fine for now but when we come to add collisions there may be problems with moving 7 at a time because the bullet might skip over the enemy. This is eli's task but I haven't seen him post anything yet.

ARE YOU OUT THERE ELI?

Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 21st Aug 2010 18:26
I've updated the OP and added the full program code as it is at the moment.

We need someone to write a routine for generating some placeholder graphics and storing them as images, coloured boxes will be fine for now. Whoever is first to post gets the job!

I'll be back later to go through the rest of the code.

I'm going to set us a deadline for release on 12th September 2010. I think we can achieve this if we keep up to speed (and I don't go awol for days on end!).

AJAtom
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location:
Posted: 21st Aug 2010 19:36 Edited at: 21st Aug 2010 19:39
lol Obese you can get rid of the stuff inside the asterisks for my part in the main program, It doesnt do anything to help the final project.

Also I get what you are saying BN2, so im busy switching over to arrays.

Also I was checking for sprite collision for sprite 1 because it wasnt being used after it was cloned off of. So I put a temp use to it.

BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 22nd Aug 2010 00:39
After being cloned off, how do you use it (e.g. with a pic of all the aliens, a bounding box, etc)?

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
AJAtom
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location:
Posted: 22nd Aug 2010 00:55 Edited at: 22nd Aug 2010 00:55
I use to do everything like this.

>create the first sprite
>clone it 41 times
>move the first sprite out of the screen and out of the way, never to use it again.
>move the other 41 sprites together in a group.

Now instead of actually putting sprite 1 on the top shelf and forgetting about it, Im using it to test what happens when aliens get shot.

like click on one of the moving aliens in the middle with your mouse, and you will see my problem.

BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 22nd Aug 2010 08:50 Edited at: 22nd Aug 2010 10:02
Alright. So I don't have a fix yet but here is my initial diagnosis:

NOTE: I set the sync rate to 10 so that I could test it in a slower environment.

1. At first I was puzzled as to why there was a flickering sprite on the second row. When I would click ANYWHERE it would flash and a sprite would disappear. After removing the HIDE SPRITE 1 command, I saw that sprite 1 was just chilling there at coordinates 50,40. A couple verifications later, I realized that the flashing of the sprite was caused by that sprite "dieing" and getting filled with something else. The flickering/dieing would stop once it was no longer colliding with sprite 1.

Probable intended solution: Place sprite 1 at the mouse location after clicking.

2. Your code needs a LOT more comments. They should explain not only what the code does, but how it does it and WHY you did it that way. No need for paragraphs, but every line or two should have some explanation. Remember, its your notes to the reader so the reader knows whats going through your head.

That being said, I cannot find any kind of code that structures the aliens. What this means is once you kill an alien, there doesn't seem to be any code that would preserve that space, which probably accounts for the alien dieing and then a sprite being placed there.

Solution: While you are working on using arrays, it would be wise to include an array with 2 dimensions, the first being the enemy number and the second should have 2 values, one for the X coordinate of the alien and one for the Y value (it might look like this: Alien_Pos(MaxNumberOfAliens,2) ). This could also be tied in with your other implementation of arrays, though it would take some thought. If you want to pursue it, I will let you figure it out and I will be here to help you along, but it is a good habit to try to figure it out on your own.

Why this is an appropriate solution: It will give you more control over where an alien is and where it is going. By having the value stored you simply have to ask the program "Is it moving left?" If so, you just decrease its location as stored in the array. Then you display based on its array data.

Make sense? I am kinda tired right now so I am fuzzy on if I explained the concept well enough here.


[relatively pointless EDIT]
On a whim, I just tried to see if I could do the entire alien movemnt and player shooting (including colliding with and killing the aliens) 100% WITHOUT sprites. It can be done. In fact, I like it better than when I did it WITH sprites (less buggy).

DO NOT interpret this to mean you did it wrong or there is a better way to do it, but if you get bored and/or finished debugging, it is an interesting challenge (Involves lots of planning ahead).

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 23rd Aug 2010 06:31
Sorry for the double post, but I checked the last couple pages and I noticed a few things:

There have been NO posts from these people in the last week (at least):

-Eminent
-Shadow
-Eli

I am not one to suggest people get dropped, but it seems to me that they checked out.

IF YOU ARE HERE AND JUST HAVEN'T POSTED, SAY SOMETHING!!

If none of them post within the next few days, I believe that their roles should be re-delegated to active members.

As always, its Obese's call.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 23rd Aug 2010 07:55 Edited at: 23rd Aug 2010 07:56
Eli hasn't posted anything since the first day so I assume he has left us.

I think I will just put out jobs that I see and people can pick the ones they want.

So far we need someone to take over Eli's job managing collisions and we need someone to make a routine to generate and store placeholder graphics for everyone to use in their tests. These can be simple coloured boxes.

Don't feel you have to wait until you have a big update to post here, it is good to keep in communication.

BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 23rd Aug 2010 08:47
I have some placeholder graphic templates that I used for mine. They should work for you guys, assuming everything is done in 25x25 boxes.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Daygamer
14
Years of Service
User Offline
Joined: 16th Mar 2010
Location: United States
Posted: 23rd Aug 2010 16:42 Edited at: 23rd Aug 2010 17:07
Quote: "So far we need someone to take over Eli's job managing collisions"


@Obese, you mean the collisions between the bullets and aliens, ect. I would like you give it a try if you could give me some guidelines.

And sorry, I haven't made those changes to my play movement and firing, yet. I'll get it done.

We will finish this game, everyone!

EDIT:

LOL, I didn't realize you already coded out the changes I needed to make in your post. Sorry, I could have gotten this done a lot sooner. But here's what I've got right now:





yrotate when you can spin?
God Bless!
Eminent
13
Years of Service
User Offline
Joined: 15th Jul 2010
Location:
Posted: 23rd Aug 2010 18:16
Couldnt post messages. Something about a seperator missing.


BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 23rd Aug 2010 20:47
@Eminent

Hmmm interesting, well glad to have you back in action.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose

Login to post a reply

Server time is: 2024-04-26 17:39:54
Your offset time is: 2024-04-26 17:39:54