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
Daygamer
14
Years of Service
User Offline
Joined: 16th Mar 2010
Location: United States
Posted: 10th Aug 2010 06:07
Yes cool, It would be nice with flags too.



It checks if the return key is being pressed and if it is then it won't let the player pause or unpause the game.

The advantage is you don't have to make the player use two different keys to pause and unpause the game, which can kinda bother them.

Don't worry if you don't understand it though. Just thought I'd throw that out there.

Coding is just better with music
God Bless!
AJAtom
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location:
Posted: 10th Aug 2010 06:34 Edited at: 10th Aug 2010 07:27
Edit: Why do I always have sudden thought revelation AFTER I post?
Oh well ill fill this post up later with my progress on wed.

Daygamer
14
Years of Service
User Offline
Joined: 16th Mar 2010
Location: United States
Posted: 10th Aug 2010 07:38
Hey, AJAtom, I don't really know what grid system means.

Are you trying to do something like this:



I would do it something like that, but with a counter so you don't have to pause the program.



Of course you'd have to do that with all your aliens.

I don't know if I'm on track at all, but no one has responded to your problem very quickly, so I thought I'd try to help.

Coding is just better with music
God Bless!
Shadow000
13
Years of Service
User Offline
Joined: 31st Jul 2010
Location:
Posted: 10th Aug 2010 08:25
@Daygamer: Proof for what I said earlier. I did get the toughest job.

Don't expect the barriers to be neat. I'm gonna create 4 pictures and make an object bullet that if collide()=1 for the 4th time, it goes to picture two for the barrier. three stages of damage. I'm starting now. (BTW, I thought Google SketchUp could do some images for DBpro. Turns out not)



Shadow000
13
Years of Service
User Offline
Joined: 31st Jul 2010
Location:
Posted: 10th Aug 2010 09:07
Well, sorry for the double post, but I did 4-1-hit-down barriers. Reason is, with these I can have 10 different occasions. If I did more, It'd be a nightmare. How to make an image collide?



BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 10th Aug 2010 10:47
I'm a little confused as to your approach here shadow. Explain to me in perfect detail how you are tackling the barriers system.

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: 10th Aug 2010 15:20
I made images, one for each possibility that can occur in the game, and I'm planning to make four of the first one on screen. Then, the program will check if the player's bullet of the monsters' bullet collides, and replace the picture with another one, one with a blacked out part. And so on.



Eminent
13
Years of Service
User Offline
Joined: 15th Jul 2010
Location:
Posted: 10th Aug 2010 17:27
For the barriers , why not make a one hit barrier section ? Then when it is destroyed immediately replace it with another one. There would be 3 replacements. After that, its destroyed.
AJAtom
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location:
Posted: 10th Aug 2010 17:48 Edited at: 10th Aug 2010 17:53
@daygamer, yea that is the plan I was using before. the problem was is that have the enemies in a

for enemy=2 to totalaliens

so everytime counter equaled 100 it would only move one alien to the right. instead I had to get rid of this command

alienx=sprite x(enemy)

at the beginning of the loop.
the problem with this plan is that when the program starts and counter doesnt equal 100 yet it still runs this command

sprite enemy,alienx,newalieny,1

and since "alienx" isnt defined it automatically equals zero wich puts all the aliens at the point 0,0 at the top left of the screen, stacking them all on top of eachother. so I need a way to define "alienx" without totally wrecking the rest of the program



Eminent
13
Years of Service
User Offline
Joined: 15th Jul 2010
Location:
Posted: 10th Aug 2010 19:28
Anyone know how to make a text box? As they can put text into the box?
Daygamer
14
Years of Service
User Offline
Joined: 16th Mar 2010
Location: United States
Posted: 10th Aug 2010 19:48
@AJAtom: Well, I was having trouble following all your code, but it looks like your on the right track.

I know it's possible because I messed around with it last night, and was able to get the aliens to move sideways and down like in the original arcade version. I don't know if it would be right to post that code though.

Good luck though, buddy. I bet your final version awesome, because your putting so much thought into it

Coding is just better with music
God Bless!
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 10th Aug 2010 20:08 Edited at: 10th Aug 2010 20:18
Just noticed this thread. you might want to look at the 20 liners section in the Space Invaders compo for ideas. My full version I have put up towards the end includes all the original sounds and graphics in data. You are welcome to grab my data out and use it here. Other than that I could possibly find out the original waves I have and post em.
Edit Not sure how you are going about this, but I used the point command to check for collisions on base and enemies. If your bullet hits a base (green) then it pastes a black damage image over the base graphic at or near those co-ordinates. Same with aliens bombs. If you wanted snazzy graphics rather than the original basic ones, you just make a mask of the images and use that on a hidden screen.

http://s6.bitefight.org/c.php?uid=103081
AJAtom
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location:
Posted: 10th Aug 2010 21:08
@daygamer, thanks, your E-credit+1
and about your code, how many aliens do you have on the screen at once?

also @eminent
you can make a text box by first using the...

set text opaque





basically the function creates a box long enough to fit the text in, and then puts the text inside it. you can fiddle around with it like say you want the message to move down and the bottom of the box to extend.

BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 10th Aug 2010 22:42
A text box would probably be best created as an image, so that it can be deleted without messing up whats underneath. I would suggest using AJAtom's code, but on a new bitmap.

Bitmaps are kinda like interchangeable screens. What you see is bitmap 0. Everything after that is more of a piece of scratch paper. In this case, you should create a bitmap, do your drawing, then use GET IMAGE to get the message box. Delete the bitmap when you are done (and so that later you don't try to create a bitmap that already exists).

Follow all that?

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: 10th Aug 2010 22:57
@AJAtom, I had 4 aliens in my little test.

I controled each with two different position values. Like this



Well, that's a little messy, but that way I can increase them all at the same time, the same distance.



And when the aliens get to the end of the screen you could do the same with the alien_pos_y.

There's probably a better way, but it worked for my test

Coding is just better with music
God Bless!
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 10th Aug 2010 23:04
Here's an idea for massive amounts of aliens.

IDK if this works in dbp, it definitely works in dbc (I have been working on my own version along side you guys). Last I checked DBP didn't have pixel perfect collision detection for sprites, so even if sprite 2 were in black (invisible) spots on sprite 1, it would still be considered a collision.

If they have fixed it, then here is a method that works quite nicely.
Create a new bitmap. USE PASTE IMAGE to place every alien in their appropriate location. Use GET IMAGE to grab the entire alien bunch. Place them as a sprite on the main screen. When your shot collides with the aliens as a whole, Find the difference between the shots position and the sprites position to figure out which alien you hit (just a matter of dividing the difference by whatever size your aliens are).

I would check to see if DBP has pixel perfect collision though, I couldn't even get my code to run right in dbp for some reason, pretty sure it didn't like some of my images.

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: 10th Aug 2010 23:27 Edited at: 10th Aug 2010 23:29
I think I know what you are talking about BN2 and if I am right, then no it doesn't.

pure black spaces still count as part of the bitmap. If it was different in DBC I wonder why they took it out?

also @Overviewer(i guess this is Obese)
How many aliens do you want for the first level?
My code is flexible with the amount of enemies (runs 60 at max) but not as controlled as daygamers so if there is less than 10 I might intergrate his....if thats all right with you daygamer

Eminent
13
Years of Service
User Offline
Joined: 15th Jul 2010
Location:
Posted: 10th Aug 2010 23:49 Edited at: 11th Aug 2010 01:07
I meant a box in which the player could type something in. I need it for screen res.
Anyways I have the menu thing down except that I cant exit out of settings.

I think the mousewithin is messed up in Settings subroutine.
Daygamer
14
Years of Service
User Offline
Joined: 16th Mar 2010
Location: United States
Posted: 11th Aug 2010 00:02
Quote: "I might intergrate his....if thats all right with you daygamer"


Yes of course, I'd be glad to have you use it.

Coding is just better with music
God Bless!
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 11th Aug 2010 00:20
For typing you would probably want to use the ENTRY$(). Thats a bit of a complicated set, though requiring many extra lines of code. If its just for testing/debugging purposes, just use input (keep in mind, input PAUSES the entire program until you enter something and press enter). If you want to be able to type things in and still have other things going on, you need entry$()

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 11th Aug 2010 04:12
from Shadow000

Quote: "I made images, one for each possibility that can occur in the game, and I'm planning to make four of the first one on screen. Then, the program will check if the player's bullet of the monsters' bullet collides, and replace the picture with another one, one with a blacked out part. And so on."


One way to tackle this and use only 1 image per barrier (on DBC at least), is to store the barrier's pixel colors in a 2 dimensional array. When the barrier is hit by a missile, you loop through the pixel array of the particular barrier, and based on a radius or locus of points from the point of impact, change the color of the pixels at the locations in the array to pure black.

Then redraw the barrier on an off-screen bitmap my looping through the array and replotting using dot. Then recapture the image. If it is a sprite, it will be redrawn where ever the original was but now with transparent damage. This can allow the damage to take any shape once collision has occurred.

I'm not sure how comfortable you guys are with arrays and offscreen bitmaps though

Enjoy your day.
Shadow000
13
Years of Service
User Offline
Joined: 31st Jul 2010
Location:
Posted: 11th Aug 2010 10:38
Uhh.... I have no problem with some small arrays... but... well... that's kinda hard. I just started programming. I mean, if you help me a bit by using examples and explaining, I'll see what I can do.



Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 11th Aug 2010 20:47
@Shadow
The way I thought of doing it was use a sprite for each section.
Here I've written some of the code for you because it is pretty tricky.
I've blanked out the drawing part but I have it here if you need help with positioning them.


BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 11th Aug 2010 20:54
Honestly Obese, as little more than a bystander, I am kinda confused at what you are looking for with the barriers.

How exactly do the 10 sections work? Is it 10 sections in every barrier or 10 possible locations for barriers, 4 of which will be occupied? If it is 10 sections, how is it divided? 10 even horizontal rows?

Every space invaders clone I have played was either the whole barrier could only take 4 hits or it would slowly get eaten away pixel by pixel.

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: 11th Aug 2010 21:49
I used 8 sections in each barrier in my code.
The clone I played had ten sections like this

mine loses the last line.
The idea is they each take four hits before being destroyed.

If this is too complicated we can change plans and make each barrier a single sprite which takes four hits.

It's Wednesday, have you guys got any new code or updates or questions for me?

BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 11th Aug 2010 22:49
@Obese

Ahhh much more clear, hope that helps them out. 4 hits per section though, with 10 sections and 3-4 barriers, isn't that a LOT of damage? I mean, you could just camp underneath one and let the aliens hit the barriers and explode (unless you aren't including that part)

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: 11th Aug 2010 23:33 Edited at: 11th Aug 2010 23:38
Quote: "I mean, you could just camp underneath one and let the aliens hit the barriers and explode (unless you aren't including that part)"


I think you can't shoot through the barriers though, right? You must move out from under them to shoot the aliens, which exposes yourself. maybe

@Obese, here's my code for player movement and firing. I attached a zip file with the media I used.



I didn't know for sure if the code should have media at this point so just in case I'm posting my media free code too.



Is this about what you were picturing for player movement and firing? Any suggestions?


Coding is just better with music
God Bless!

Attachments

Login to view attachments
AJAtom
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location:
Posted: 12th Aug 2010 00:17 Edited at: 13th Aug 2010 18:08
Here Is my code for the alien movement and firing, you can change the number of aliens by changing the

maxaliens

variable. If you notice though when it hits the side the grid changes, I havent been able to sort out the bug because of summer projects .

Edit: bug fixed



Also I already have an Idea how to find the right most and left most alien, but I have been waiting because I didnt have shot collision ( because there is no shot lol)

Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 12th Aug 2010 02:20
Quote: "Barriers"


The array thing I mentioned is a bit much ( I was originally thinking memblocks and trying to adapt that - not for beginners )

I thought of a simple variation. In DBC, (maybe in Pro also) you can paste a sprite like an image. In DBC, you also cannot capture a sprite with GET IMAGE. That means, you capture whatever is behind the sprite. This is where I am going:

Assuming the barriers are sprites - 4 sprites = 4 barriers

1. Check for a sprite hit with missile (either player or enemy)

2. Paste the barrier sprite that was struck at it's current position using PASTE SPRITE. (in dbc this requires a sync after the paste)

3. set the ink color to black

4. draw damage using box, circle, dot, line - whatever - from the point of impact to maybe 10 pixels or so in each direction

5. recapture the full barrier image at it's location including of course, the newly drawn damage in pure black. GET IMAGE etc.

6. redraw the sprite with it's new image. SPRITE <num>,x,y,<img>

This will allow the barriers to be eaten away hit by hit.

Enjoy your day.
Shadow000
13
Years of Service
User Offline
Joined: 31st Jul 2010
Location:
Posted: 12th Aug 2010 06:49 Edited at: 12th Aug 2010 06:58
Obese, on line 21 if your code, what do the question marks mean/do? Nothing I presume.

Edit: I'll finish with this in a day or two... I hope. I'm currently looking up the help files, see what code I will use to place barriers.



Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 12th Aug 2010 11:30
Quote: "Obese, on line 21 if your code, what do the question marks mean/do? Nothing I presume."

They make noobs write code

Shadow000
13
Years of Service
User Offline
Joined: 31st Jul 2010
Location:
Posted: 12th Aug 2010 16:48
A little help please.



Eminent
13
Years of Service
User Offline
Joined: 15th Jul 2010
Location:
Posted: 12th Aug 2010 18:28
Any good GUI dll to spice up the menu?
AJAtom
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location:
Posted: 12th Aug 2010 19:40 Edited at: 12th Aug 2010 21:30
@eminent
you could create a function that creates a bitmap the size of the image you want to be your message then draws a box on the new bitmap.
then when the mouse is over the message the box appears and grows more transparent until its just a shadow, then disappears when you take the cursor off.

if you dont know what im talking about, I dont blame you haha im not good at explaining

Edit: I finally figured out the bug, and it only took one line! I've edited my code that I posted on Wed., So its bug free

Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 12th Aug 2010 23:26 Edited at: 13th Aug 2010 07:12
Here's my full code for positioning the barriers

I haven't been able to test it so I hope it works.
I don't like to do it for you but it took me a while to work out so it's a bit trickier than I thought. I will explain how it works so you can get to grips with the code and continue with it.

Ok, we have four barriers, each has eight sections that can take four hits. The first thing we need to do is find a way to store how many hits each section of barrier has taken, this is the priority because it will influence other things like which image to display.
We'll use an array to store the data because they are easy to reference.

The remarks tell us that the array is storing data about the barriers like this...

Remember that zero is a number too and you can use entry zero to store data in an array. Zero is very useful to us in many circumstances like this, because as you see we have split our array into groups of eight and to find which group our number is in we simply divide by eight (taking the integer), i.e. 0/8=0, 5/8=0, 7/8=0, 8/8=1, 12/8=1, 16/8=2, 26/8=3. If we started storing data at entry one we couldn't do this so easily, we'd have to subtract one from the entry number every time.

Ok, so now we know how we are going to divide the groups how do we know where to place them? Well we have two scopes of positioning here; the position of the barriers and, on a local level, the position of the individual sections of each barrier. Let's first look at the barriers.
We need to position them evenly across the screen, so that means we need to divide the screen width (if we use screen width() instead of a fixed number we can deal with many screen resolutions without having to alter the code).

I'm too ninish to finish explaining now...
[edit]
haha ninish means tired

Continuing, we again use the screen resolution to get the height at which to place the barriers (screen height()), I'm not sure if 75% looks right because I haven't tested it.

The bxoffset will help us centre the barrier on its proper location. Each barrier is four section across so if we move the position two sections back the mid point will be in between the 2nd and 3rd sections (in the middle).

Now the nasty complicated bit where everything comes together! We position the barriers.

This is a good exercise in thinking in steps, some tasks can seem daunting until you break them down into smaller tasks. The first task here is to position the barriers as a whole so we make a loop to count through all four barriers. The next thing we have to do is position the sections, and because the sections are within the barriers we put a for loop to count the sections inside the barrier loop. Okay, so now we have a structure that counts through every section moving from one barrier to the next.

The next thing to consider is that sections are arranged in two lines, so we simply check if we've gone past half way if sec >= 4.
The code for both halves is mostly the same with only two differences: if we're in the first half we move the sections up one place so we are vertically centred on the barrier's location y = posy-secsize, and if we are in the second half we don't need to adjust height (remember sprites are positioned from the top left corner) but we need to move the sections in the lower half back four places x = (barr+1)*divw#+(sec-4)*secsize-bxoffset. This is because we are positioning the sections horizontally according to their number, so if we kept going without moving the bottom line back it would look like this:

Now we have the positions we draw the section sprite:
sprite barr*8+sec, x, y, barrdam(barr*8+sec)
If you are wondering what "barr*8+sec" means, that gets us the number of the section, if you remember we numbered the sections 0-31 when we made the array "barrdam(31)".

Hopefully that explains everything, I'm ninished .

Daygamer
14
Years of Service
User Offline
Joined: 16th Mar 2010
Location: United States
Posted: 12th Aug 2010 23:53
It's looking good. What's the next step?

Coding is just better with music
God Bless!
Eminent
13
Years of Service
User Offline
Joined: 15th Jul 2010
Location:
Posted: 13th Aug 2010 03:28 Edited at: 13th Aug 2010 03:53
Heres what I have so far. I fixed where you couldnt get out of settings and made it possible to change the resolution. Going into 960x720 doesnt work or maybe its just my comp. And pause volume slider doesnt work[FIXED]

EDIT : Forgot to erase a few temp lines. Slider works now.
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 13th Aug 2010 04:33 Edited at: 13th Aug 2010 04:35
@Eminent:
Don't want to have you re-do everything here, but did you catch the PERFORM CHECKLIST FOR DISPLAY MODES command?

Basically, you put that line in and it populates the checklist variables with the data. Here is a (working) example. It will detect every display mode and output all the data.


I would suggest using the Checklist String$() to display the info (since it formats it nicely for you) and use the Checklist Value variables to use the info (So SET DISPLAY MODE Checklist Value A(1),Checklist Value B(1), Checklist Value C(1) and so forth)

Also, I notice you are doing BOX X1,Y1,X2,Y2,Color1,Color2,Color3,Color4

If you use the INK command once, it will set the drawing color and you can omit putting in the color arguments.

So instead of

You can just do


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: 13th Aug 2010 05:01 Edited at: 13th Aug 2010 05:08
Yeah but I want different colors. Writing one RGB command then C+Ping it is about the same time as making an ink command so yeah. The Perform CheckList helped. Now the last thing screen res works

Done my job.
*realizes he has to do the sprite animations and graphics*
NOOOOOOOOOOOOOOOOOO!!!!!!!!!!!
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 13th Aug 2010 05:18
Quote: "Done my job."


Wait, just looked it over again. Looks like Several subroutines are missing a return command BAD NEWS.

Also, you have WAY too many DO-LOOPS. Try restructuring it into only having a single DO loop that just contains basic stuff and subroutine calls.

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: 13th Aug 2010 05:49
What? Theres only one SR with no return and thats the Playing one. Its a goto. Only a one way jump is needed anyways. I wouldnt call 3 WAY too much but ill restructure it anyways. Was wanting to get rid of that Goto.
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 13th Aug 2010 06:47
Here is the program skeleton

All your code will go into those subroutines.
It's good to try and only have one sync in the whole program so I've set up the main loop with one and it will execute the menu code when the game is paused or there is no game running, and it will run the game code when there is a game running that isn't paused.

Eminent, the menu will be used for new games and pausing, the changes you need to make are:
* remove the "until done=1" loop
* Only display new game, settings and exit to windows options when game=0
* Only display continue game, end game and volume settings options when game=1
* when a new game is selected game=1 and reset all game variables to default (we don't know what the variables are yet so just leave space for that).
* when continue game is selected pause=0
* when end game is selected pause=0 and game=0
* when exit to windows is selected end program

BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 13th Aug 2010 06:55
@Eminent

Yeah goto's are bad. While they can be the only way to do something, that just means you did other things wrong.

Menu: also has no return.

Regarding the too many loops: each program should only have 1 main loop (that means only 1 do-loop). Some people even say that you shouldn't have ANY do-loops because they don't have a built in exit condition. Either way, never have more than 1.

Sorry if I sound a little cranky, for the last hour or so I have been tracing a bug in my own program. I have it narrowed down to the exact line causing it, but I can't figure out why the crash is occurring.

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: 13th Aug 2010 07:32 Edited at: 13th Aug 2010 07:56
Shadow, I've finished explaining the barriers above for you. Do they make sense?

Eminent, I'm going to add more reasons why goto's are bad (can you tell we don't like them?). Gotos remind of when people give you directions without mentioning any road names or landmarks, they just say "left, right, right, straight on"...


Subroutines are like things we've learned, if I wanted you to make me a cup of tea I'd just ask you to make a cup of tea, I wouldn't say "go into the kitchen, pick up the kettle, fill it with water..." I assume you know what is involved in the making of a cup of tea.

That's the great thing about subs, once you've got them working you can pack them away and think of them as a single process.

I even made an image...


Eminent
13
Years of Service
User Offline
Joined: 15th Jul 2010
Location:
Posted: 13th Aug 2010 16:54 Edited at: 13th Aug 2010 16:59
Yeah I know Gotos are bad, but I cant see why they cant be used once for a one way jump. Anyways, shouldnt the menu go first? Here I deleted the goto and put the Playing subroutine right after the Menu sub. The reason I dont have a return in menu is because I thiought you guy would be displaying the menu first. I replaced the do loops with repeat untils and theres only 1 left in playing.
Eminent
13
Years of Service
User Offline
Joined: 15th Jul 2010
Location:
Posted: 13th Aug 2010 17:28
Ok so Im starting animation. Im looking at BN2s code snippet and I dont get it.

What am I supposed to put in for imgnumber in the sprite command?


BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 13th Aug 2010 18:51
Quote: "What am I supposed to put in for imgnumber in the sprite command?"


You put the image number of the current frame of the animation. So, for instance, if you had an animation that used 3 total images and these images were stored at 15,16, and 17, then imgnumber would be 15, then 16, then you change it to 17.

Follow? The idea here is that a sprite can have its image changed at any time.

Here I uber commented the code for you, maybe that will shed some light:



Hope this clears things up a bit. I am going to be a jury duty today, so I will probably be checking back here frequently (they should have wi-fi there) so let me know if you have any questions.

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: 13th Aug 2010 19:01
How do I store a picture IN the imgnumber variable?


BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 13th Aug 2010 20:23
Well you aren't storing a picture, you're storing the pictures IMAGE NUMBER into the variable.

So you can do this:


Its nothing special, just a way to use variables to mean something.

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: 13th Aug 2010 23:18 Edited at: 13th Aug 2010 23:25
OMG, you guys are on and post so much when I'm off...
Going to check the code now.

Edit: It DOES make sense, however I would never be able to code THAT alone... I'll see if I can add something so I can say that I have helped in this project...

I think this is the full code:




Login to post a reply

Server time is: 2024-04-19 10:47:43
Your offset time is: 2024-04-19 10:47:43