Latest Uploads
Bumble Bee

dna

Tires

dna

Guess The Remake

rychan

Julia Set Visualer

Andy_A

Julia Set Visualizer

Andy_A

image-07-0 ... -34-29.jpg

Jayenkai

Forum Home

Who codes on/for Nintendo DS?

UserMessage
Posted : Friday, 12 October 2007, 14:57 | Permalink
spinal


I'm just wondering, because I feel bad pestering Jay all of the time with what usually end up being really simple problems. Also It would be good to work with others who are just starting out on the DS so I don't feel so stupid asking those simple questions.

-----
Download "Don't Flip Out!" Directly to your OUYA! (Click Here).
Homepage : http://spinalcode.co.uk
Posted : Friday, 12 October 2007, 14:58 | Permalink | Mark Here
Jayenkai


I do!!!

Homepage : http://AGameAWeek.com
Posted : Friday, 12 October 2007, 15:32 | Permalink | Mark Here
mike_g


WW Entries : 6
I don't, but it sounds like fun. I cant see myself buying a DS, but I have an old SP kicking about somewhere. Maybe I'll see if I can get hold of a writeable cartridge for it sometime.
Posted : Saturday, 13 October 2007, 12:55 | Permalink | Mark Here
rockford


I really want to get into coding games for the DS, so if anyone wants a learning partner, then I'm your guy! I've very little C++ experience, but I've coded many, many games in various other languages from AMOS to BlitzMax, with lots of Div, Blitz and PlayBasic in between. In fact I recently won the Retro Remakes P&C challenge with my "Off THe Mortal Coil" game (cheers for the bug report Jayenkai).

I did a puzzle game in Blitz that I'd love to port onto DS and it should work well.

I have a DS and an R4 if I need to test stuff on a real machine.
Posted : Saturday, 13 October 2007, 13:35 | Permalink | Mark Here
spinal


Well I guess the first step is to get hold of devkitpro and get coding. I also use palib, it has a whole bunch of useful functions for gfx and sound and whatnot.

-----
Download "Don't Flip Out!" Directly to your OUYA! (Click Here).
Homepage : http://spinalcode.co.uk
Posted : Saturday, 13 October 2007, 14:18 | Permalink | Mark Here
Afr0


WW Entries : 3

I really want to get into coding games for the DS, so if anyone wants a learning partner, then I'm your guy! I've very little C++ experience, but I've coded many, many games in various other languages from AMOS to BlitzMax


Not to be rude, but that's a bit like saying that you wanna drive a passenger airplane, but you've only ever driven taxis to and from the airport! There's a shitload of difference between most BASIC-like languages and C (which is what's used to program the DS; Not C++). However, if you are really, really motivated, there's no reason why you shouldn't be able to master it. Just give yourself alot of time and be patient.

-----
Afr0 Games

Project Dollhouse on Github - Please fork!
Homepage : http://www.afr0games.com
Posted : Saturday, 13 October 2007, 14:50 | Permalink | Mark Here
mike_g


WW Entries : 6
I have seen some of the stuff that rockford has made, and if he can do that then I'm sure he can get his head around C/C++. Its not as incredibly complex as you seem to want to make out, especially if you have a couple of useful libraries to work with.
Posted : Saturday, 13 October 2007, 15:40 | Permalink | Mark Here
Jayenkai


WW Entries : 103
"(cheers for the bug report Jayenkai)."

Wha..?

Aaaah! You're that same guy as what that other guy is that isn't called you but is you!
'ello you!

Afr0, seriously, that's a really terrible analogy!

If anything his use of BB/B3D and BlitzMax has pretty much prepared him for most things that C can throw at him. It'd be more like flying a harrier jump jet, but wanting to fly an airliner.
It's the same sort of thing, but all the buttons are in the wrong places, and god only knows what you're supposed to do with the strings...

And don't worry about "Proper C!"
If you want to use C like you use Blitz, go right ahead and bring all your buggy Basic habits along with you. C can cope with most "messy" coding better than people give it credit for.

Just.. If you can avoid strings, do!

As Spinal suggests, download DevKitPro, then PA_Lib, then install in that order.
Head into the PA_Lib examples directory, and you should be able to work things out for yourself, if not..
..
I keep saying I'll write a tutorial on all this. If you can't manage it, let me know, and I'll get off my arse and do that tutorial!

-----
"Load, Next List!"
Homepage : http://AGameAWeek.com
Posted : Saturday, 13 October 2007, 15:47 | Permalink | Mark Here
mike_g


WW Entries : 6
In C++ you can manipulate strings in a very similar way to Blitz. A lot of work has gone into abstracting strings from a character array. I made my own string class in C++ which was pretty pointless really, but with a little tweaking all the functions can be made to run in C. I guess I might post it in the code snippets section in case anyone finds a use for it.
Posted : Sunday, 14 October 2007, 01:47 | Permalink | Mark Here
Afr0


WW Entries : 3
And don't worry about "Proper C!"
If you want to use C like you use Blitz, go right ahead and bring all your buggy Basic habits along with you. C can cope with most "messy" coding better than people give it credit for.


That's actually terrible advice! One of the largest and easiest pitfalls to slip into for people starting up with new languages, is expecting to be able to code like they did in their old language with their new language. Whenever you learn a new language, you have to wipe your mind completely free of things like coding style (I.E indentation, spacing etc.), debugging methods, syntax (usually not in terms of basic arithmetic operators and such, because those are usually pretty much the same, but certainly in terms of how descriptive a language is and such (C, for instance, is a very descriptive language, which means you have to, in most cases, try to get rid of the habbit most BB/B3D users seems to have of trying to put everything belonging to an application into 1 gigantomongous file, and design the application in general based on that principle. You also have to be very familiar with C's syntax before writing anything huge and/or advanced, because the moment you start copying something out of a book without getting it's meaning, you are absolutely lost, and the same thing goes for using too many advanced and unneccessary syntax 'trixes' in one program, because you'll usually end up going back later on without knowing shite about what the code originally meant.)) ++.

-----
Afr0 Games

Project Dollhouse on Github - Please fork!
Homepage : http://www.afr0games.com
Posted : Sunday, 14 October 2007, 05:58 | Permalink | Mark Here
mike_g


WW Entries : 6
I wouldn't recommend coding in C like you would in Blitz. It might be possible to get away with it for little things, but on larger projects you would be likely to end up with a hideous mess. Its definitely a good idea to keep data as localised as possible. That said I still don't know where Afr0 gets this idea that everyone who uses Blitz always codes everything in one huge file o_0
Posted : Sunday, 14 October 2007, 06:27 | Permalink | Mark Here
Jayenkai


WW Entries : 103
I don't mean entirely messily! (And, for reference, If you aren't splitting things up into neat functions, you're about to learn the second you TRY to use C!..)

What I meant was..
Instead of doing "Standard C" and ending up with bizarre lines of garbled mess, you can do things "Blitz-like" and keep understanding it the way you always have.

You know.. Where you can grab the scrollbar, flick through your code, and instantly find the little bit you need.

I mean, flick through hoboben's String To Uppercase function, and look at all the varying degrees of readability in the included source.

Some of that, you can get in an instant. Other bits are single line messy horrible lines of gunk.

IMO, that has no place in my code. If I can't flick/find/tweak then what's the point in having it there?

-----
"Load, Next List!"
Homepage : http://AGameAWeek.com
Posted : Monday, 15 October 2007, 04:03 | Permalink | Mark Here
Afr0


WW Entries : 3
That said I still don't know where Afr0 gets this idea that everyone who uses Blitz always codes everything in one huge file o_0


-->

-->

-->

[code];*************************************************************************** ;* Rocktoids: Asteroids-like Space Game ;* Coded By: Krylar ;* Last Updated: 7/28/2001 ;* Update Info: Made the sounds work with 1.50+ versions of BlitzBasic ;* Also changed a number of BMP's to PNG's to save space ;*************************************************************************** ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Set up the constant vars ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;General constants Const ScreenWidth=800, ScreenHeight=600 ;Holds the Screen Resolutions Const NumRotations=36 ;Holds how many times to rotate the ship Const NumberOfShips = 3 ;Holds the number of ships to start with Const MaxShips = 7 ;Holds the maximum number of ships allowed Const NumberOfAsteroids = 5 ;Holds the number of asteroids to start with Const ShipThrust# = .03 ;Holds the thrusting speed of the ship Const ShipBraking# = .975 ;Holds the braking speed of the ship Const ShipTopSpeed# = 3 ;Holds the top speed of the ship Const BulletDistance = 60 ;Holds the distance a bullet can travel Const ShieldEffectTime = 7000 ;Holds the time the shield is in effect Const PowerupEffectTime = 40000 ;Holds the time a powerup is in effect Const ShipTurningSpeed = 20 ;Holds the time for the turning speed of the ship ;Keyboard Constants Const LeftArrow=203, RightArrow=205 ;Holds Left/Right arrows (not keypad) Const UpArrow=200, DownArrow=208 ;Holds Up/Down arrows (not keypad) Const LeftKPArrow=75, RightKPArrow=77 ;Holds Left/Right arrows (keypad) Const UpKPArrow=72, DownKPArrow=80 ;Holds Up/Down arrows (not keypad) Const SpaceBar=57 ;Holds the spacebar Const Enter=28 ;Holds the Enter/Return key ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Set up the global vars ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Global Image pointers Global CCNBCLogo_Image ;Holds the Christian Coders Network image Global KrylarLogo_Image ;Holds the Krylar's Kreations Image Global Rocktoids_Image ;Holds the Rocktoids Image Global Image_StarsFar ;Holds the far backround stars image Global Image_StarsMid ;Holds the middle backround stars image Global Image_StarsClose ;Holds the close backround stars image Global Powerup_Image ;Holds the Powerup Image ;Global Image Arrays Dim ShipFreighter_Image(36) ;Holds the Frieghter images Dim ShipFreighterShield_Image(36) ;Holds the Frieghter Shield images Dim ShipFreighterAccel_Image(36) ;Holds the Frieghter Accelerate images Dim ShipFreighterAccelShield_Image(36) ;Holds the Frieghter Accelerate Shield images Dim ShipFreighterPower_Image(36) ;Holds the Frieghter Powerup images Dim ShipFreighterPowerShield_Image(36) ;Holds the Frieghter Powerup Shield images Dim ShipFreighterPowerAccel_Image(36) ;Holds the Frieghter Powerup Accelerate images Dim ShipFreighterPowerAccelShield_Image(36) ;Holds the Frieghter Powerup Accelerate Shield images Dim Bullet_Image(36) ;Holds the Bullet images Dim BigAsteroid_Image(36) ;Holds the Big Asteroid images Dim LittleAsteroid_Image(36) ;Holds the Little Asteroid images ;Global Animation pointers Global Explosion_Anim ;Holds the regular explosion animation Global BigExplosion_Anim ;Holds the big explosion animation Global LittleExplosion_Anim ;Holds the little explosion animation ; Global Scroll_StarsX#, Scroll_StarsY# ;the back parallaxing vars Global Scroll_StarsX2#, Scroll_StarsY2# ;the middle parallaxing vars Global Scroll_StarsX3#, Scroll_StarsY3# ;the front parallaxing vars Global iSpeedModifier# ;holds top speed per x,y angle ;Global physics table arrays Dim xSinTable#(NumRotations) ;Holds our SIN data Dim yCosTable#(NumRotations) ;Holds our COS data Dim xTopSpeedTable#(NumRotations) ;Holds our X top-speeds (dependant on direction) Dim yTopSpeedTable#(NumRotations) ;Holds our Y top-speeds (dependant on direction) Dim xTSTable#(NumRotations/4) ;Holds values to calculate xTopSpeedTable# array values Dim yTSTable#(NumRotations/4) ;Holds values to calculate yTopSpeedTable# array values ;Global Sound variables and loads Global Laser_Sound ;Holds the laser sounds Global ShipExplosion_Sound ;Holds the extra-loud ship explosion sound Global Explosion_Sound ;Holds the standard explosion sound Global Regeneration_Sound ;Holds the ship regeneration sound Global Powerup_Sound ;Holds the sound for when a player picks up a powerup Global Powerdown_Sound ;Holds the sound for when the powerup expires Global Engine_Sound ;Holds the engine sound Global Rocktoids_Music ;Holds the Rocktoids music sound Global Engine_Sound_Channel ;Holds the engine sound channel information ;Globals for various timing functions Global Current_Time ;Holds the current Time for all of the controllers Global Main_Timer ;Holds the main game loop time controller Global ShipTurn_Timer ;Holds the ship turning time controller Global Firing_Timer ;Holds the firing time controller Global Level_Timer ;Holds the between levels time controller Global Powerup_Timer ;Holds the powerup available to catch time controller Global PowerupInEffect_Timer ;Holds the powerup is in effect time controller Global ShieldInEffect_Timer ;Holds the shield is in effect time controller ;Globals for Miscellaneous Game Flags Global iGameOver = 0 ;Holds the GameOver flag (0=Game is On, 1=Game is over) Global iTotalShips = NumberOfShips ;Holds the starting number of ships Global iAsteroids = NumberOfAsteroids ;Holds our starting number of Asteroids Global iLevel = 1 ;Holds the current level number the player is on Global iLevelComplete = 1 ;Holds the LevelComplete Flag (0=NOT complete, 1=Complete) Global iBulletsFired# = 0 ;Holds the number of bullets fired during the level Global iHits# = 0 ;Holds the number of hits made during the level Global iAverageHits = 0 ;Holds the value of Average hits Global iTotalPoints = 0 ;Holds the total points for the player until Game Over Global iFireSpeed = 250 ;Holds the timer value for launching bullets Global iPowerupOn = 0 ;Holds the Powerup flag (0=No Powerup, 1=Powerup) Global iAccel = 0 ;Holds the Acceleration flag (0=Not accelerating, 1=accelerating) Global PlayerRegen = 0 ;Holds the Player regeneration flag (0=Not regenerating, 1=regenerating) Global spawntime Global PowerupAvailable=0 Global ShieldOn=1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Set up the Types here ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; build our Ship Type Type Ship Field iDir ;Holds the direction the ship is facing Field dX#,dY# ;Holds the screen X,Y coordinates of the ship Field dSpeedX#,dSpeedY# ;Holds the current speed for x and for y Field dThrust#, dTopSpeed# ;Holds the thrusting speed and top speed Field dBraking# ;Holds the braking speed Field iAlive ;Holds the status of the ship (0=dead, 1=alive) End Type ;Create a NEW element of type Ship that's global Global Player.Ship = New Ship ; Asteroid Type Type Asteroid Field iDir ;Holds the direction the asteroid is moving Field dX#,dY# ;Holds the screen x,y coordinates of the asteroid Field dSpeedX#, dSpeedY# ;Holds the current speed for x and for y Field iLevel ;Holds the level of the asteroid (1=small,n=big) Field iType ;Holds the type of asteroid (0=doesn't split,1=splits) Field iFrame ;Holds the current frame in the animation Field iAsteroidTimeStart ;Holds the starting time of the frame, for animation Field iTimer ;Holds the current timer for each asteroid, for animation End Type ; Bullet structure Type Bullet Field iDir ;Holds the direction the Bullet is moving Field dX#,dY# ;Holds the screen x,y coordinates of the bullet Field dDistance ;Holds the counter to see if a bullet has run it's course Field dSpeedX#, dSpeedY# ;Holds the current speed for x and for y Field dSpeedModifier# ;Holds the added speed of the bullet to the current speed End Type ; Explosion structure Type Explosions Field dX#,dY# ;Holds the screen x,y coordinates of the explosion Field iType ;Holds the type of explosion (0=ship,1=big,2=little) Field iFrame ;Holds the current frame in the animation Field iExplosionTimeStart ;Holds the starting time of the frame, for animation Field iTimer ;Holds the current timer for each explosion, for animation End Type ; Powerup structure Type Powerup Field dX#,dY# ;Holds the screen x,y coordinates of the powerup Field dSpeedX#, dSpeedY# ;Holds the current speed for x and for y Field iType ;Holds the type of powerup (there's only one right now) Field iPowerupTimeStart ;Holds the starting time of the powerup Field iTimer ;Holds the current timer for the power (so it's only available for a bit) End Type ; Initialize the graphics Graphics ScreenWidth, ScreenHeight ; Setup the Backbuffer for page flipping SetBuffer BackBuffer() ; Load the graphics from the file(s) LoadGraphics() ; Load the sounds from the file(s) LoadSounds() ; Initialize the player's info LaunchShip() ; Call the functions that setup our 2D "Physics" PrecomputeSinCosTables() PrecomputeTopSpeedTables() ; Show the splash screens ShowSplashScreens() ; Initialize the timers InitializeTimers() ;******************************************************************* ;* ;* main loop...keep looping until the user hits ESC ;* ;******************************************************************* While Not KeyDown(1) ; clear the screen Cls ; grab the "Current_Time" for other functions to use Current_Time=MilliSecs() ; draw up the starfield...I don't do this in RenderScene() because ; I have the stars behind various other points that aren't in ; RenderScene() RenderStarfield() ; check to see if the game is over, and if it is restart it If iGameOver = 1 Then RestartGame() EndIf ; see if the shield is available or if it's timed-out CheckShieldStatus() ; check to see if we can put up another power-up, or if it's in use CheckPowerupAvailability() ; check to see if the user has completed the level. If so, start ; up the next level. If not, render the scenes. If iLevelComplete = 1 Then StartNextLevel() Else RenderScene() EndIf ; draw the little ships in the upper left to let the player know ; how many ships are available ShowRemainingShips() ; show the current score up top ShowScore() ; Flip the pages Flip Wend ; Delete the Player instance Delete Player ; End of the program End ;******************************************************************* ;* ;* All of the function that make up this game ;* ;******************************************************************* ;************************************************************* ; FUNCTION: RenderScene() ; Author: Krylar ; Last Updated: 10/22/2000 ; ; This function draws all of the images on the screen and ; makes calls to CheckKeys() too ;************************************************************* Function RenderScene() ; this little timer piece was basically lifted from Insectoids (thanks, guys!) elapsed=Current_Time-Main_Timer If elapsed>25 ;slowing down! - clamp update to 40 FPS (1000/40=25 millisecs) cnt=elapsed/25 For k=1 To cnt ; update the various Asteroid positions and draw them in their new spots UpdateAsteroids() ; update the various bullet positions and draw them in their new spots UpdateBullets() ; update the power-up position and draw in the new spot UpdatePowerups() ; update the various explosion animation and draw the proper frame UpdateExplosions() ; if the player's ship is still alive, check to see if any keys are ; being pressed and then draw the ship If Player\iAlive = 1 CheckKeys() RenderPlayer() EndIf Next ; add the appropriate offset to the Main_Timer controller Main_Timer=Main_Timer+cnt*25 Else ;leave frame synced... ; update the various Asteroid positions and draw them in their new spots UpdateAsteroids() ; update the various bullet positions and draw them in their new spots UpdateBullets() ; update the power-up position and draw in the new spot UpdatePowerups() ; update the various explosion animation and draw the proper frame UpdateExplosions() ; if the player's ship is still alive, check to see if any keys are ; being pressed and then draw the ship If Player\iAlive = 1 CheckKeys() RenderPlayer() EndIf ; set Main_Timer to be the Current_Time Main_Timer=Current_Time EndIf ; if the ship has been destroyed If Player\iAlive = 0 ; tell the player that we're going to re-spawn the ship Text ScreenWidth/2, ScreenHeight/2, "Re-spawning Ship!",1,1 ; and show that message for about 2 seconds spawnship_time=MilliSecs() elapsed=spawnship_time-spawntime If elapsed>2000 And PlayerRegen = 0 ; play the cool Regenerating Ship sound PlaySound(Regeneration_Sound) ; set the flag for the ship to finish regeneration PlayerRegen = 1 EndIf ; since the player has died, use the elapsed variable to ; set the shield on, set the shield timer and re-spawn the ship If elapsed>4500 ShieldOn = 1 ShieldInEffect_Timer=MilliSecs() LaunchShip() EndIf ; make sure the firing speed is reset iFireSpeed = 250 ; make it so we can't start spawning powerups again iPowerupOn = 0 PowerupAvailable = 0 Powerup_Timer=MilliSecs() EndIf End Function ;************************************************************* ; FUNCTION: InitializeLevel() ; Author: Krylar ; Last Updated: 10/22/2000 ; ; This function sets up a level with more asteroids than the ; last level and makes sure that there aren't any left overs ; from the last level ;************************************************************* Function InitializeLevel(iAsteroids) ; remove any lingering asteroids For A.Asteroid = Each Asteroid Delete A Next ; remove any lingering bullets For B.Bullet = Each Bullet Delete B Next ; remove any lingering explosions For E.Explosions = Each Explosions Delete E Next ; remove any lingering powerups For P.Powerup = Each Powerup Delete P Next ; create a new field of asteroids with the amount based on the current ; game level For i=0 To iAsteroids LaunchAsteroid() Next End Function ;************************************************************* ; FUNCTION: StartNextLevel() ; Author: Krylar ; Last Updated: 10/22/2000 ; ; This function resets necessary things and calls the ; InitializeLevel() and LaunchShip() functions to do the rest ;************************************************************* Function StartNextLevel() ; setup the level information screen to show for a few seconds Level_time=MilliSecs() elapsed=Level_time-Level_Timer If elapsed>4500 ; reset all the variables and initialize the level and the ship ShieldOn = 1 ShieldInEffect_Timer=MilliSecs() iLevelComplete = 0 iBulletsFired = 0 iHits = 0 iAverageHits = 0 InitializeLevel(iAsteroids) iAsteroids = iAsteroids + 5 LaunchShip() InitializeTimers() Else ; show a message to everyone that the next level is starting If iBulletsFired > 0 Then iAverageHits = (iHits#/iBulletsFired#) * 100 Text ScreenWidth/2, (ScreenHeight/2)-32, "Bullets Fired = "+Int(iBulletsFired),1,1 Text ScreenWidth/2, (ScreenHeight/2)-16, "Number of Hits = "+Int(iHits),1,1 Text ScreenWidth/2, (ScreenHeight/2), "Accuracy Average = "+iAverageHits+"%",1,1 EndIf Text ScreenWidth/2, (ScreenHeight/2)+16, "Get Ready for Level "+iLevel,1,1 EndIf End Function ;************************************************************* ; FUNCTION: RestartGame() ; Author: Krylar ; Last Updated: 10/22/2000 ; ; This function totally flushes everything and restarts ;************************************************************* Function RestartGame() ; reset all the variables and initialize the level and the ship ShieldOn = 1 iPowerupOn = 0 iFireSpeed = 250 PowerupAvailable = 0 iLevelComplete = 1 iTotalShips = NumberOfShips iLevel = 1 iAsteroids = 5 InitializeLevel(iAsteroids) ; show the final score Text ScreenWidth/2, (ScreenHeight/2)+16, "Final Score: "+iTotalPoints+" -- Press the Enter key to continue...",1,1 iTotalPoints = 0 Flip ; wait for the player to hit ENTER While Not KeyHit(Enter) ; just sit here. Wend Cls ; start it all up again! iGameOver = 0 InitializeTimers() End Function ;************************************************************* ; FUNCTION: LaunchShip() ; Author: Krylar ; Last Updated: 10/22/2000 ; ; This function sets up the player's ship ;************************************************************* Function LaunchShip() ; start out the player in the center of the screen Player\dX=(ScreenWidth/2) - (ImageWidth(ShipFreighter_Image(0))/2) Player\dY=(ScreenHeight/2) - (ImageHeight(ShipFreighter_Image(0))/2) ; make sure the ship is at a dead stop Player\dSpeedX=0 Player\dSpeedY=0 ; face the ship due north Player\iDir=0 ; set the thrust speed Player\dThrust=ShipThrust# ; and the top speed Player\dTopSpeed=ShipTopSpeed# ; and the braking speed Player\dBraking=ShipBraking# ; set the ship to be alive and working! Player\iAlive = 1 End Function ;************************************************************* ; FUNCTION: CheckKeys() ; Author: Krylar ; Last Updated: 10/22/2000 ; ; This function checks to see what keys the player is ; pressing and will take action accordingly ;************************************************************* Function CheckKeys() ; Did the player fire? If KeyDown(SpaceBar) Then new_time=MilliSecs() time_elapsed=new_time-Firing_Timer If time_elapsed > iFireSpeed Then Firing_Timer=MilliSecs() ; launch a bullet LaunchBullet(Player\dX, Player\dY, Player\iDir) EndIf EndIf ; END the LeftArrow check ; START the RightArrow check If KeyDown(RightArrow) Or KeyDown(RightKPArrow) Then ;check the speed at which the ship can turn time_elapsed=Current_Time-ShipTurn_Timer If time_elapsed > ShipTurningSpeed Then ShipTurn_Timer=MilliSecs() ; spin the ship to the right Player\iDir = Player\iDir + 1 If(Player\iDir > NumRotations-1) Then Player\iDir = 0 EndIf EndIf EndIf ; END the RightArrow check ; START the LeftArrow check If KeyDown(LeftArrow) Or KeyDown(LeftKPArrow) Then ;check the speed at which the ship can turn time_elapsed=Current_Time-ShipTurn_Timer If time_elapsed > ShipTurningSpeed Then ShipTurn_Timer=MilliSecs() ; spin the ship to the left Player\iDir = Player\iDir - 1 If(Player\iDir < 0) Then Player\iDir = NumRotations-1 EndIf EndIf EndIf ; END the LeftArrow check ; START the UpArrow check ; This section controls the Thrust of the ship and so on ; study this one carefully If KeyDown(UpArrow) Or KeyDown(UpKPArrow) Then If ChannelPlaying(Engine_Sound_Channel) <> 1 Engine_Sound_Channel = PlaySound(Engine_Sound) EndIf iAccel = 1 ; add the thrust information to the current x,y vars ; of the ship's directional vectors Player\dSpeedX# = Player\dSpeedX# + (xSinTable#(Player\iDir) * Player\dThrust#) Player\dSpeedY# = Player\dSpeedY# + (yCosTable#(Player\iDir) * Player\dThrust#) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; This handles the N, N/E quadrant ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; If Player\iDir < 9 Then ;Handling the X axis there If Player\dSpeedX# < 0 - xTopSpeedTable#(Player\iDir) Then ; see if we need to subtract faster off the X axis due to angle If Player\iDir < 5 ; use the 5th xSinTable spot to decrease X speed at a reasonable rate Player\dSpeedX# = Player\dSpeedX# - (xSinTable#(5) * Player\dThrust#) Else ; Otherwise just use the normal Sin information for normal decrease Player\dSpeedX# = Player\dSpeedX# - (xSinTable#(Player\iDir) * Player\dThrust#) EndIf EndIf ;Handling the Y axis there If Player\dSpeedY# > yTopSpeedTable#(Player\iDir) Then ; see if we need to subtract faster off the Y axis due to angle If Player\iDir > 4 ; use the 5th xSinTable spot to decrease Y speed at a reasonable rate Player\dSpeedY# = Player\dSpeedY# - (yCosTable#(5) * Player\dThrust#) Else ; Otherwise just use the normal Cos information for normal decrease Player\dSpeedY# = Player\dSpeedY# - (yCosTable#(Player\iDir) * Player\dThrust#) EndIf EndIf EndIf ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; This handles the E, S/E quadrant ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; If Player\iDir >= 9 And Player\iDir < 18 Then ;Handling the X axis there If Player\dSpeedX# < 0 - xTopSpeedTable#(Player\iDir) Then ; see if we need to subtract faster off the X axis due to angle If Player\iDir > 13 ; use the 14th xSinTable spot to decrease X speed at a reasonable rate Player\dSpeedX# = Player\dSpeedX# - (xSinTable#(14) * Player\dThrust#) Else ; Otherwise just use the normal Sin information for normal decrease Player\dSpeedX# = Player\dSpeedX# - (xSinTable#(Player\iDir) * Player\dThrust#) EndIf EndIf ;Handling the Y axis there If Player\dSpeedY# < 0 - yTopSpeedTable#(Player\iDir) Then ; see if we need to subtract faster off the Y axis due to angle If Player\iDir < 14 ; use the 14th xSinTable spot to decrease Y speed at a reasonable rate Player\dSpeedY# = Player\dSpeedY# - (yCosTable#(14) * Player\dThrust#) Else ; Otherwise just use the normal Cos information for normal decrease Player\dSpeedY# = Player\dSpeedY# - (yCosTable#(Player\iDir) * Player\dThrust#) EndIf EndIf EndIf ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; This handles the S, S/W quadrant ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; If Player\iDir >= 18 And Player\iDir < 27 Then ;Handling the X axis there If Player\dSpeedX# > xTopSpeedTable#(Player\iDir) Then ; see if we need to subtract faster off the X axis due to angle If Player\iDir < 23 ; use the 23rd xSinTable spot to decrease X speed at a reasonable rate Player\dSpeedX# = Player\dSpeedX# - (xSinTable#(23) * Player\dThrust#) Else ; Otherwise just use the normal Sin information for normal decrease Player\dSpeedX# = Player\dSpeedX# - (xSinTable#(Player\iDir) * Player\dThrust#) EndIf EndIf ;Handling the Y axis there If Player\dSpeedY# < 0 - yTopSpeedTable#(Player\iDir) Then ; see if we need to subtract faster off the Y axis due to angle If Player\iDir > 22 ; use the 23rd xSinTable spot to decrease Y speed at a reasonable rate Player\dSpeedY# = Player\dSpeedY# - (yCosTable#(23) * Player\dThrust#) Else ; Otherwise just use the normal Cos information for normal decrease Player\dSpeedY# = Player\dSpeedY# - (yCosTable#(Player\iDir) * Player\dThrust#) EndIf EndIf EndIf ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; This handles the W, N/W quadrant ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; If Player\iDir >= 27 Then ;Handling the X axis there If Player\dSpeedX# > xTopSpeedTable#(Player\iDir) Then ; see if we need to subtract faster off the X axis due to angle If Player\iDir > 31 ; use the 32nd xSinTable spot to decrease X speed at a reasonable rate Player\dSpeedX# = Player\dSpeedX# - (xSinTable#(32) * Player\dThrust#) Else ; Otherwise just use the normal Sin information for normal decrease Player\dSpeedX# = Player\dSpeedX# - (xSinTable#(Player\iDir) * Player\dThrust#) EndIf EndIf ;Handling the Y axis there If Player\dSpeedY# > yTopSpeedTable#(Player\iDir) Then ; see if we need to subtract faster off the Y axis due to angle If Player\iDir < 32 ; use the 32nd xSinTable spot to decrease Y speed at a reasonable rate Player\dSpeedY# = Player\dSpeedY# - (yCosTable#(32) * Player\dThrust#) Else ; Otherwise just use the normal Cos information for normal decrease Player\dSpeedY# = Player\dSpeedY# - (yCosTable#(Player\iDir) * Player\dThrust#) EndIf EndIf EndIf Else iAccel = 0 EndIf ; END the UpArrow check ; START the DownArrow check If KeyDown(DownArrow) Or KeyDown(DownKPArrow) Then ; slow down the ship Player\dSpeedX = Player\dSpeedX * Player\dBraking Player\dSpeedY = Player\dSpeedY * Player\dBraking ; check for stop on ship's X axis If Player\dSpeedX < .001 And Player\dSpeedX > -.001 Then Player\dSpeedX = 0 EndIf ; check for stop on ship's Y axis If Player\dSpeedY < .001 And Player\dSpeedY > -.001 Then Player\dSpeedY = 0 EndIf EndIf ; END the DownArrow check End Function ;************************************************************* ; FUNCTION: CheckShieldStatus() ; Author: Krylar ; Last Updated: 10/22/2000 ; ; This function determines if the shield should still be on ; or not ;************************************************************* Function CheckShieldStatus() If ShieldOn = 1 Then elapsed=Current_Time-ShieldInEffect_Timer If elapsed > ShieldEffectTime PlaySound Powerdown_Sound ShieldOn=0 EndIf EndIf End Function ;************************************************************* ; FUNCTION: RenderPlayer() ; Author: Krylar ; Last Updated: 10/22/2000 ; ; This function draws the player image on the screen after ; first determining if the player has been struck by an ; asteroid. Also, the proper image will be displayed based ; on shield, powerup, acceleration, etc. ;************************************************************* Function RenderPlayer() ; set the collision flag to zero iCollision = 0 ; update the ship's x coordinates Player\dX = Player\dX - Player\dSpeedX If Player\dX > ScreenWidth Then Player\dX = 0 EndIf If Player\dX < 0 Then Player\dX = ScreenWidth EndIf ; update the ship's y coordinates Player\dY = Player\dY - Player\dSpeedY If Player\dY > ScreenHeight Then Player\dY = 0 EndIf If Player\dY < 0 Then Player\dY = ScreenHeight EndIf ; if the shield is OFF, check to see if any of the asteroids have hit the ; ship. If so, make an explosion sound, play the animation for the ship ; blowing up and then set the timer to show a new ship. If ShieldOn = 0 Then For A.Asteroid = Each Asteroid If A\iLevel = 1 ; did one of the little asteroids hit the ship? If ImagesCollide(ShipFreighter_Image(Player\iDir),Player\dX,Player\dY,0,LittleAsteroid_Image(A\iFrame),A\dX,A\dY,0) Then ; quiet the engine, play the explosions PlaySound ShipExplosion_Sound PlaySound Explosion_Sound ; setup the explosion animations for both the asteroid and the ship LaunchExplosion(A\dX,A\dY,0) LaunchExplosion(Player\dX,Player\dY,1) ; delete that particular asteroid Delete A ; reset the player information, remove 500 points and remove a ship ; from the ship list Player\iAlive = 0 spawntime=MilliSecs() PlayerRegen = 0 iTotalPoints = iTotalPoints - 500 iTotalShips = iTotalShips - 1 ; if there are no ships left...GAME OVER! If iTotalShips = 0 iGameOver = 1 EndIf EndIf Else ; did one of the little asteroids hit the ship? If ImagesCollide(ShipFreighter_Image(Player\iDir),Player\dX,Player\dY,0,BigAsteroid_Image(A\iFrame),A\dX,A\dY,0) Then ; quiet the engine, play the explosions PlaySound ShipExplosion_Sound PlaySound Explosion_Sound ; setup the explosion animations for both the asteroid and the ship LaunchExplosion(A\dX,A\dY,0) LaunchExplosion(Player\dX,Player\dY,1) ; delete that particular asteroid Delete A ; reset the player information, remove 500 points and remove a ship ; from the ship list Player\iAlive = 0 spawntime=MilliSecs() PlayerRegen = 0 iTotalPoints = iTotalPoints - 500 iTotalShips = iTotalShips - 1 ; if there are no ships left...GAME OVER! If iTotalShips = 0 iGameOver = 1 EndIf EndIf EndIf Next EndIf ; assuming the player is still alive, check to see if the player has ; successfully picked up a power-up If Player\iAlive = 1 Then For P.Powerup = Each Powerup ; has the ship hit a powerup? If ImagesCollide(ShipFreighter_Image(Player\iDir),Player\dX,Player\dY,0,Powerup_Image,P\dX,P\dY,0) Then ; play the powerup sound PlaySound Powerup_Sound ; increase the firing speed iFireSpeed = 100 ; let the rest of the system know that the powerup is on the ship iPowerupOn = 1 PowerupAvailable=1 ; set the powerup's timer PowerupInEffect_Timer = MilliSecs() ; delete the floating powerup (the image) Delete P EndIf Next ; if the powerup is NOT in effect If iPowerupOn = 0 Then ; if we're NOT accelerating If iAccel = 0 Then ; if the shield is NOT on If ShieldOn = 0 Then ; draw the normal ship image DrawImage ShipFreighter_Image(Player\iDir),Player\dX,Player\dY Else ; the shield IS on, so draw the shielded ship image DrawImage ShipFreighterShield_Image(Player\iDir),Player\dX,Player\dY EndIf ; we ARE accelerating Else ; if the shield is NOT on If ShieldOn = 0 Then ; draw the normal acclerating ship image DrawImage ShipFreighterAccel_Image(Player\iDir),Player\dX,Player\dY Else ; the shield IS on, so draw the shielded acclerating ship image DrawImage ShipFreighterAccelShield_Image(Player\iDir),Player\dX,Player\dY EndIf EndIf ; the powerup IS on Else ; if we're NOT accelerating If iAccel = 0 Then ; if the shield is NOT on If ShieldOn = 0 Then ; draw the powerup ship image DrawImage ShipFreighterPower_Image(Player\iDir),Player\dX,Player\dY Else ; the shield IS on, so draw the shielded powerup ship image DrawImage ShipFreighterPowerShield_Image(Player\iDir),Player\dX,Player\dY EndIf ; we ARE accelerating Else ; if the shield is NOT on If ShieldOn = 0 Then ; draw the powerup acclerating ship image DrawImage ShipFreighterPowerAccel_Image(Player\iDir),Player\dX,Player\dY Else ; the shield IS on, so draw the shielded powerup accelerating ship image DrawImage ShipFreighterPowerAccelShield_Image(Player\iDir),Player\dX,Player\dY EndIf EndIf EndIf EndIf End Function ;************************************************************* ; FUNCTION: ShowRemainingShips() ; Author: Krylar ; Last Updated: 10/22/2000 ; ; This function shows the user how many ships are left in the ; upper left corner ;************************************************************* Function ShowRemainingShips() ; get our starting X coordinate iXShow = ImageWidth(ShipFreighter_Image(0))/2 + 2 ; loop through the remaining ships and draw them For i=1 To iTotalShips-1 DrawImage ShipFreighter_Image(0),iXShow,10 ; calculate the x position for the next image iXShow = iXShow + ImageWidth(ShipFreighter_Image(0)) + 5 Next End Function ;************************************************************* ; FUNCTION: RenderStarfield() ; Author: Krylar ; Last Updated: 10/22/2000 ; ; This function will draw the three levels of stars, but ; doesn't do any parallaxing or anything ;************************************************************* Function RenderStarfield() ; Fill the whole background with the 3 star layers ; in their current positions TileBlock Image_StarsFar,Scroll_StarsX,Scroll_StarsY TileImage Image_StarsMid,Scroll_StarsX2*2,Scroll_StarsY2*2 TileImage Image_StarsClose,Scroll_StarsX3*3,Scroll_StarsY3*3 End Function ;************************************************************* ; FUNCTION: ShowScore() ; Author: Krylar ; Last Updated: 10/22/2000 ; ; This function shows the score centered at the top of the ; screen ;************************************************************* Function ShowScore() Text ScreenWidth/2-20,16,"Score: "+iTotalPoints,1,1 End Function ;************************************************************* ; FUNCTION: LaunchAsteroid() ; Author: Krylar ; Last Updated: 10/2/2000 ; ; This function initializes a new asteroid with a random ; speed and vector ;************************************************************* Function LaunchAsteroid() ; set up a new instance of the asteroid A.Asteroid = New Asteroid ; randomize it's X and Y location A\dX = Rnd(ScreenWidth) A\dY = Rnd(ScreenHeight) ; randomize the direction it's floating in A\iDir = Rnd(1,NumRotations) -1 ; randomize it's speed A\dSpeedX# = (xSinTable#(A\iDir)) * Rnd#(.3,1.5) A\dSpeedY# = (yCosTable#(A\iDir)) * Rnd#(.3,1.5) ; randomize which frame to start on A\iFrame = Rnd(1,NumRotations) -1 ; set the frame animation speed controller A\iAsteroidTimeStart=MilliSecs() ; set the frame animation speed determination variable A\iTimer = Rnd(50,150) ; randomize whether it's a splittable or non-splittable asteroid A\iLevel = Rnd(0,3) ; initialize it to being a Big asteroid A\iType = 0 End Function ;************************************************************* ; FUNCTION: SplitAsteroid() ; Author: Krylar ; Last Updated: 10/22/2000 ; ; This function will split a large asteroid into many smaller ; asteroids, each with their own speeds and vectors ;************************************************************* Function SplitAsteroid(iX, iY) ; randomize the number of asteroids to break off from the big asteroid iNewAsteroids = Rnd(0,3) ; loop through that random number For i=0 To iNewAsteroids ; create a new instance A.Asteroid = New Asteroid A\dX = iX A\dY = iY ; randomize the direction it's floating in A\iDir = Rnd(1,NumRotations)-1 ; randomize it's speed A\dSpeedX# = (xSinTable#(A\iDir)) * Rnd#(.5,1.75) A\dSpeedY# = (yCosTable#(A\iDir)) * Rnd#(.5,1.75) ; randomize which frame to start on A\iFrame = Rnd(1,NumRotations) -1 ; set the frame animation speed controller A\iAsteroidTimeStart=MilliSecs() ; set the frame animation speed determination variable A\iTimer = Rnd(50,150) ; make it un-splittable A\iLevel = 1 ; initialize it to being a little asteroid A\iType = 1 Next End Function ;************************************************************* ; FUNCTION: UpdateAsteroids() ; Author: Krylar ; Last Updated: 10/22/2000 ; ; This function will keep the asteroids moving ;************************************************************* Function UpdateAsteroids() ; see if there are any asteroids left A.Asteroid = First Asteroid ; if not, set the level to be complete and give the player ; a bonus ship (assuming the player doesn't already have too many) If A = Null Then iLevelComplete = 1 iLevel = iLevel + 1 Level_Timer=MilliSecs() iTotalShips = iTotalShips + 1 If iTotalShips > MaxShips iTotalShips = MaxShips EndIf ; if we still have asteroids left Else ; run through each asteroid For A.Asteroid = Each Asteroid ; update the x,y coords of the asteroid A\dX# = A\dX# + A\dSpeedX# A\dY# = A\dY# + A\dSpeedY# ; if it goes off the screen, wrap it to the other side If A\dX < -20 Then A\dX = ScreenWidth + 20 EndIf If A\dX > ScreenWidth + 20 Then A\dX = -20 EndIf If A\dY < -20 Then A\dY = ScreenHeight + 20 EndIf If A\dY > ScreenHeight + 20 Then A\dY = -20 EndIf ; check to see if this asteroid is ready to change frames new_time=MilliSecs() time_elapsed=new_time-A\iAsteroidTimeStart ; if so, add to the frame count, wrap to zero if past the number ; of avaible frames If time_elapsed > A\iTimer A\iFrame = A\iFrame + 1 If A\iFrame > NumRotations - 1 A\iFrame = 0 EndIf ; reset the animation controller A\iAsteroidTimeStart=MilliSecs() EndIf ; if it's a Big asteroid If A\iType = 0 DrawImage BigAsteroid_Image(A\iFrame),A\dX,A\dY ; if it's a little asteroid Else DrawImage LittleAsteroid_Image(A\iFrame),A\dX,A\dY EndIf Next EndIf End Function ;************************************************************* ; FUNCTION: LaunchBullet(...) ; Author: Krylar ; Last Updated: 10/22/2000 ; ; This function creates a bullet for display. It creates ; the bullet to fly out at the proper angle and speed based ; on the player's angle and speed. ;************************************************************* Function LaunchBullet(iX, iY, iDir) ; play the laser sound PlaySound Laser_Sound ; create a new Bullet instance B.Bullet = New Bullet ; have it's starting point be the center of the player's ship B\dX = Player\dX B\dY = Player\dY ; and have it face the same direction as the player B\iDir = Player\iDir ; give it a bit of a faster speed than the player B\dSpeedModifier = 1 ; determine the player's speed amd create the bullet speed based on that B\dSpeedX# = ((xSinTable#(B\iDir)) * (Player\dTopSpeed# + B\dSpeedModifier#)) B\dSpeedY# = ((yCosTable#(B\iDir)) * (Player\dTopSpeed# + B\dSpeedModifier#)) ; increment the number of bullets fired for this level iBulletsFired = iBulletsFired + 1 End Function ;************************************************************* ; FUNCTION: UpdateBullets() ; Author: Krylar ; Last Updated: 10/22/2000 ; ; This function keeps the bullets moving, checks if they've ; hit anything, and kills them if they go off-screen ;************************************************************* Function UpdateBullets() ; go through all of the bullets For B.Bullet = Each Bullet ; update their x,y positions B\dX# = B\dX# - B\dSpeedX# B\dY# = B\dY# - B\dSpeedY# ; set the collision flag to zero iCollision = 0 ; run through the asteroids to check for collisions For A.Asteroid = Each Asteroid ; if it's a little asteroid we're checking against If A\iLevel = 1 Then ; see if the bullet has hit the little asteroid If ImagesCollide(Bullet_Image(B\iDir),B\dX,B\dY,0,LittleAsteroid_Image(A\iFrame),A\dX,A\dY,0) Then ; add to the hits and total points iHits = iHits + 1 iTotalPoints = iTotalPoints + 100 ; play the explosion sound PlaySound Explosion_Sound ; launch a small explosion LaunchExplosion(B\dX,B\dY,0) ; remove both the bullet and asteroid instances Delete A Delete B ; notify that we have a hit iCollision = 1 ; exit this loop Exit EndIf ; if it's a big asteroid we're checking against Else ; see if the bullet has hit the big asteroid If ImagesCollide(Bullet_Image(B\iDir),B\dX,B\dY,0,BigAsteroid_Image(A\iFrame),A\dX,A\dY,0) Then ; add to the hits and total points iHits = iHits + 1 iTotalPoints = iTotalPoints + 100 ; play the explosion sound PlaySound Explosion_Sound ; launch a big explosion LaunchExplosion(B\dX,B\dY,2) ; split the asteroid if appropriate SplitAsteroid(A\dX,A\dY) ; remove both the bullet and asteroid instances Delete A Delete B ; notify that we have a hit iCollision = 1 ; exit this loop Exit EndIf EndIf Next ; if no collisions for this bullet If iCollision = 0 Then ; if the bullet is off the screen, delete it If B\dX < 0 Or B\dX > ScreenWidth Or B\dY < 0 Or B\dY > ScreenHeight Then Delete B Else ; otherwise, draw it DrawImage Bullet_Image(B\iDir),B\dX,B\dY EndIf EndIf Next End Function ;************************************************************* ; FUNCTION: CheckPowerupAvailability() ; Author: Krylar ; Last Updated: 10/22/2000 ; ; This function determines if a powerup is already in use. ; If not it will randomly decide to make one available. If ; it does decide it, it will launch that powerup. ;************************************************************* Function CheckPowerupAvailability() ; first make sure that it's not already out there If PowerupAvailable = 0 Then ; then if it's within a certain time frame pwrup_elapsed=Current_Time-Powerup_Timer If pwrup_elapsed > 10000 ; and it draws a random number between 1 and 100 (that ; lands above 75)...then launch the powerup iPowerUp = Rnd(1,100) If iPowerUp > 55 Then LaunchPowerup() PowerupAvailable=1 EndIf EndIf EndIf ; if the power up is already on the ship, the keep decrementing ; it's use timer If iPowerupOn = 1 Then elapsed=Current_Time-Powerup_Timer ; if the powerup has run out of time If elapsed > PowerupEffectTime ; play the powerdown sound PlaySound Powerdown_Sound ; reset the firing speed iFireSpeed = 250 ; make the possibility of a new powerup available iPowerupOn = 0 PowerupAvailable = 0 Powerup_Timer=MilliSecs() EndIf EndIf End Function ;************************************************************* ; FUNCTION: LaunchPowerup() ; Author: Krylar ; Last Updated: 10/22/2000 ; ; This function throws out a powerup at an angle based on ; the first Asteroid in the list...made it more random ;************************************************************* Function LaunchPowerup() ; first let's make sure there's an asteroid to base this on A.Asteroid = First Asteroid ; there is, so let's use it's angle information If A <> Null Then ; add a new powerup instance P.Powerup = New Powerup ; randomize the powerups x,y starting point P\dX = Rnd(ScreenWidth) P\dY = Rnd(ScreenHeight) ; create a speed based on the angle of an asteroid P\dSpeedX# = (xSinTable#(A\iDir)) * 1.5 P\dSpeedY# = (yCosTable#(A\iDir)) * 1.5 ; set up our controller timer and our random powerup usefulness timer P\iPowerupTimeStart=MilliSecs() P\iType = 0 P\iTimer = Rnd(10000,20000) EndIf End Function ;************************************************************* ; FUNCTION: UpdatePowerups() ; Author: Krylar ; Last Updated: 10/22/2000 ; ; This function keeps the powerup moving on the screen and ; keeps track of how long it's up. If it's up for too long ; it will delete itself ;************************************************************* Function UpdatePowerups() ; run through the powerups For P.Powerup = Each Powerup ; update the x,y coordinates P\dX# = P\dX# + P\dSpeedX# P\dY# = P\dY# + P\dSpeedY# ; if it goes off the screen, wrap to the other side If P\dX < -20 Then P\dX = ScreenWidth + 20 EndIf If P\dX > ScreenWidth + 20 Then P\dX = -20 EndIf If P\dY < -20 Then P\dY = ScreenHeight + 20 EndIf If P\dY > ScreenHeight + 20 Then P\dY = -20 EndIf ; draw the image DrawImage Powerup_Image,P\dX,P\dY ; see if it should disappear or not new_time=MilliSecs() time_elapsed=new_time-P\iPowerupTimeStart ; if so, remove it If time_elapsed > P\iTimer Delete P EndIf Next End Function ;************************************************************* ; FUNCTION: LaunchExplosion() ; Author: Krylar ; Last Updated: 10/22/2000 ; ; This function will create an explosion based on the postion ; and type sent to this fuction. ;************************************************************* Function LaunchExplosion(iX, iY, iType) ; create a new explosion instance E.Explosions = New Explosions ; set it's x,y and type based on the arguments sent E\dX = iX E\dY = iY E\iType = iType ; start it at frame 0 E\iFrame = 0 ; set the frame animation speeds E\iExplosionTimeStart = MilliSecs() E\iTimer = 30 End Function ;************************************************************* ; FUNCTION: UpdateExplosions() ; Author: Krylar ; Last Updated: 10/22/2000 ; ; This function will animate each active explosion for the ; full explosion effect ;************************************************************* Function UpdateExplosions() ; run through all the explosions For E.Explosions = Each Explosions new_time=MilliSecs() time_elapsed=new_time-E\iExplosionTimeStart ; if enough time has passed to show the next frame, do so If time_elapsed > E\iTimer Then ; update the frame E\iFrame=E\iFrame+1 E\iExplosionTimeStart = MilliSecs() ; run through the different explosion types and either ; delete the explosion because it's frames have finaled, or ; draw the current frame If E\iType = 0 Then If E\iFrame>4 Then Delete E Else DrawImage Explosion_Anim,E\dX,E\dY,E\iFrame EndIf Else If E\iType = 1 Then If E\iFrame>5 Then Delete E Else DrawImage BigExplosion_Anim,E\dX,E\dY,E\iFrame EndIf Else If E\iFrame>3 Then Delete E Else DrawImage LittleExplosion_Anim,E\dX,E\dY,E\iFrame EndIf EndIf EndIf EndIf Next End Function ;************************************************************* ; FUNCTION: LoadGraphics() ; Author: Krylar ; Last Updated: 10/22/2000 ; ; This function loads up all of our graphics and animations. ;************************************************************* Function LoadGraphics() Local Image_Temp ; pointer to a Temp image ; be lazy and let BB handle the centering of the images ; during rotation AutoMidHandle True ; load up the star backgrounds (3 total) Image_StarsFar=LoadImage( "graphics\starsfar.png" ) Image_StarsMid=LoadImage( "graphics\starsmid.png" ) Image_StarsClose=LoadImage( "graphics\stars.png" ) ; load up our ship image Image_Temp=LoadImage( "graphics\ship1.bmp" ) ; set it's mask (transparent color) MaskImage Image_Temp,0,0,0 ; now run through the loop and rotate the image ; around at 10 degree increments. For iLoop=0 To NumRotations-1 ShipFreighter_Image(iLoop)=CopyImage( Image_Temp ) RotateImage ShipFreighter_Image(iLoop),iLoop*360/NumRotations Next ; load up our ship image Image_Temp=LoadImage( "graphics\ship2.bmp" ) ; set it's mask (transparent color) MaskImage Image_Temp,0,0,0 ; now run through the loop and rotate the image ; around at 10 degree increments. For iLoop=0 To NumRotations-1 ShipFreighterShield_Image(iLoop)=CopyImage( Image_Temp ) RotateImage ShipFreighterShield_Image(iLoop),iLoop*360/NumRotations Next ; load up our ship image Image_Temp=LoadImage( "graphics\shipaccl.bmp" ) ; set it's mask (transparent color) MaskImage Image_Temp,0,0,0 ; now run through the loop and rotate the image ; around at 10 degree increments. For iLoop=0 To NumRotations-1 ShipFreighterAccel_Image(iLoop)=CopyImage( Image_Temp ) RotateImage ShipFreighterAccel_Image(iLoop),iLoop*360/NumRotations Next ; load up our ship image Image_Temp=LoadImage( "graphics\shipaccl2.bmp" ) ; set it's mask (transparent color) MaskImage Image_Temp,0,0,0 ; now run through the loop and rotate the image ; around at 10 degree increments. For iLoop=0 To NumRotations-1 ShipFreighterAccelShield_Image(iLoop)=CopyImage( Image_Temp ) RotateImage ShipFreighterAccelShield_Image(iLoop),iLoop*360/NumRotations Next ; load up our ship image Image_Temp=LoadImage( "graphics\shippwr.bmp" ) ; set it's mask (transparent color) MaskImage Image_Temp,0,0,0 ; now run through the loop and rotate the image ; around at 10 degree increments. For iLoop=0 To NumRotations-1 ShipFreighterPower_Image(iLoop)=CopyImage( Image_Temp ) RotateImage ShipFreighterPower_Image(iLoop),iLoop*360/NumRotations Next ; load up our ship image Image_Temp=LoadImage( "graphics\shippwr2.bmp" ) ; set it's mask (transparent color) MaskImage Image_Temp,0,0,0 ; now run through the loop and rotate the image ; around at 10 degree increments. For iLoop=0 To NumRotations-1 ShipFreighterPowerShield_Image(iLoop)=CopyImage( Image_Temp ) RotateImage ShipFreighterPowerShield_Image(iLoop),iLoop*360/NumRotations Next ; load up our ship image Image_Temp=LoadImage( "graphics\shippwrac.bmp" ) ; set it's mask (transparent color) MaskImage Image_Temp,0,0,0 ; now run through the loop and rotate the image ; around at 10 degree increments. For iLoop=0 To NumRotations-1 ShipFreighterPowerAccel_Image(iLoop)=CopyImage( Image_Temp ) RotateImage ShipFreighterPowerAccel_Image(iLoop),iLoop*360/NumRotations Next ; load up our ship image Image_Temp=LoadImage( "graphics\shippwrac2.bmp" ) ; set it's mask (transparent color) MaskImage Image_Temp,0,0,0 ; now run through the loop and rotate the image ; around at 10 degree increments. For iLoop=0 To NumRotations-1 ShipFreighterPowerAccelShield_Image(iLoop)=CopyImage( Image_Temp ) RotateImage ShipFreighterPowerAccelShield_Image(iLoop),iLoop*360/NumRotations Next Image_Temp=LoadImage("graphics\bullet.bmp") ; set it's mask (transparent color) MaskImage Image_Temp,0,0,0 ; now run through the loop and rotate the image ; around at 10 degree increments. For iLoop=0 To NumRotations-1 Bullet_Image(iLoop)=CopyImage( Image_Temp ) RotateImage Bullet_Image(iLoop),iLoop*360/NumRotations Next Image_Temp=LoadImage("graphics\asteroid1.bmp") ; set it's mask (transparent color) MaskImage Image_Temp,0,0,0 ; now run through the loop and rotate the image ; around at 10 degree increments. For iLoop=0 To NumRotations-1 BigAsteroid_Image(iLoop)=CopyImage( Image_Temp ) RotateImage BigAsteroid_Image(iLoop),iLoop*360/NumRotations Next Image_Temp=LoadImage("graphics\asteroid2.bmp") ; set it's mask (transparent color) MaskImage Image_Temp,0,0,0 ; now run through the loop and rotate the image ; around at 10 degree increments. For iLoop=0 To NumRotations-1 LittleAsteroid_Image(iLoop)=CopyImage( Image_Temp ) RotateImage LittleAsteroid_Image(iLoop),iLoop*360/NumRotations Next ; load up the powerup image Powerup_Image=LoadImage("graphics\ammopru.bmp") ; load up the logos CCNBCLogo_Image=LoadImage("graphics\ccnbc.png") KrylarLogo_Image=LoadImage("graphics\krylarlogo.png") Rocktoids_Image=LoadImage("graphics\rocktoids.png") ; load the explosion animations Explosion_Anim=LoadAnimImage( "graphics\explosion.png",32,32,0,5 ) BigExplosion_Anim=LoadAnimImage( "graphics\explosion2.png",64,46,0,6 ) LittleExplosion_Anim=LoadAnimImage( "graphics\explosion3.png",18,22,0,4) End Function ;************************************************************* ; FUNCTION: LoadSounds() ; Author: Krylar ; Last Updated: 10/22/2000 ; ; This function loads up all our sounds ;************************************************************* Function LoadSounds() Laser_Sound = LoadSound("sounds\laser.wav") ShipExplosion_Sound = LoadSound("sounds\explosion1.wav") Explosion_Sound = LoadSound("sounds\explosion2.wav") Regeneration_Sound = LoadSound("sounds\regeneration.wav") Powerup_Sound = LoadSound("sounds\powerup.wav") Powerdown_Sound = LoadSound("sounds\powerdown.wav") Engine_Sound = LoadSound("sounds\engine.wav") ; have to set up the Rocktoids music to "Loop" because the Channel commands ; don't appear to be 100%. Make sure to only use the PlaySound command on ; this during the Splash screen section or you get TONS of noise. Rocktoids_Music = LoadSound("music\rocktoids.mp3") LoopSound Rocktoids_Music End Function ;************************************************************* ; FUNCTION: InitializeTimers() ; Author: Krylar ; Last Updated: 10/22/2000 ; ; This function let's us set all of our timers to the current ; time ;************************************************************* Function InitializeTimers() ShipTurn_Timer=MilliSecs() Firing_Timer=MilliSecs() Main_Timer=MilliSecs() Level_Timer=MilliSecs() If iPowerupOn = 0 Then Powerup_Timer=MilliSecs() EndIf PowerupInEffect_Timer=MilliSecs() ShieldInEffect_Timer=MilliSecs() End Function ;************************************************************* ; FUNCTION: PrecomputeSinCosTables() ; Author: Krylar ; Last Updated: 10/22/2000 ; ; This function calculates our SIN/COS tables ;************************************************************* Function PrecomputeSinCosTables() Local iAngle# = 0 ; run through the full rotation cycle, and use Sin and Cos ; at 10-degree increments For iAngle = 0 To NumRotations-1 xSinTable#(iAngle) = -Sin(iAngle*10) yCosTable#(iAngle) = Cos(iAngle*10) Next End Function ;************************************************************* ; FUNCTION: PrecomputeTopSpeedTables() ; Author: Krylar ; Last Updated: 10/22/2000 ; ; This function calculates our Top speeds for all directions ;************************************************************* Function PrecomputeTopSpeedTables() Local iSpeedControl# Local iXAngle = 9 Local iYAngle = 0 ; setup our speed modifier iSpeedModifier# = (Player\dTopSpeed# / (NumRotations/4)) ; save our Top Speed iSpeedControl# = Player\dTopSpeed# For iAngle = 0 To NumRotations / 4 ; assign the speed control per x,y angle xTSTable#(iXAngle) = iSpeedControl# yTSTable#(iYAngle) = iSpeedControl# ; make sure that arrays are being loaded ; in opposite directions iXAngle = iXAngle - 1 iYAngle = iYAngle + 1 ; get that ABS value of our current speed control ; minus the speed modifier iSpeedControl# = Abs(iSpeedControl# - iSpeedModifier#) ; if it's below a certain level, just set it to zero If iSpeedControl# < .0001 Then iSpeedControl# = .000000 EndIf Next ; Now we're going to load up the angle top speed tables ; so we can use the iDir to get the appropriate ; speed value per x,y angle when needed without having ; to do wacky math real-time For iAngle = 0 To 8 xTopSpeedTable#(iAngle) = xTSTable#(iAngle) yTopSpeedTable#(iAngle) = yTSTable#(iAngle) Next iNewAngle = 9 For iAngle = 9 To 17 xTopSpeedTable#(iAngle) = xTSTable#(iNewAngle) yTopSpeedTable#(iAngle) = yTSTable#(iNewAngle) iNewAngle = iNewAngle - 1 Next iNewAngle = 0 For iAngle = 18 To 26 xTopSpeedTable#(iAngle) = xTSTable#(iNewAngle) yTopSpeedTable#(iAngle) = yTSTable#(iNewAngle) iNewAngle = iNewAngle + 1 Next iNewAngle = 9 For iAngle = 27 To 35 xTopSpeedTable#(iAngle) = xTSTable#(iNewAngle) yTopSpeedTable#(iAngle) = yTSTable#(iNewAngle) iNewAngle = iNewAngle - 1 Next End Function ;************************************************************* ; FUNCTION: ShowSplashScreens() ; Author: Krylar ; Last Updated: 10/22/2000 ; ; This function let's us show off about ourselves ;) ;************************************************************* Function ShowSplashScreens() ; handle the CCN logo Cls DrawImage(CCNBCLogo_Image,(ScreenWidth/2), (ScreenHeight/2)) Flip SplashScreen_Timer=MilliSecs() While Not KeyHit(57) Current_Time=MilliSecs() elapsed=Current_Time-SplashScreen_Timer If elapsed>3000 Exit EndIf Wend ; now show the Krylar's Kreations logo Cls DrawImage(KrylarLogo_Image,(ScreenWidth/2), (ScreenHeight/2)) Flip SplashScreen_Timer=MilliSecs() While Not KeyHit(57) Current_Time=MilliSecs() elapsed=Current_Time-SplashScreen_Timer If elapsed>3000 Exit EndIf Wend ; finally show the Rocktoids logo Cls RenderStarfield() DrawImage(Rocktoids_Image,(ScreenWidth/2), (ScreenHeight/2)) Flip ; check to see if there's any music playing, if not kick off the ; little rocktoids mp3 PlaySound Rocktoids_Music SplashScreen_Timer=MilliSecs() While Not KeyHit(57) Current_Time=MilliSecs() elapsed=Current_Time-SplashScreen_Timer If elapsed>4000 Exit EndIf Wend End Function[/code]

[code]Graphics 16*32,16*32,8,2 SetBuffer BackBuffer() AppTitle"TANKTICS BY DAVID" splash=LoadImage("splash.bmp") Color 255,255,0 Repeat Cls DrawImage splash,0,0 Text 256,250,"PRESS 'P' TO PLAY",1 Flip Until KeyDown(25) FlushKeys() FreeImage splash SeedRnd MilliSecs() Global tiles=LoadAnimImage("tiles.bmp",16,16,0,9) Global tank=LoadAnimImage("tanks.bmp",16,16,0,19) MaskImage tank,255,0,255 Global map=CreateImage(16*32,16*32) SetBuffer ImageBuffer(map) Dim grid(31,31) level=Rand(1,11) file=OpenFile("levels\Level_"+level+".tnk") For x=0 To 31 For y=0 To 31 grid(x,y)=ReadByte(file) DrawImage tiles,x*16,y*16,grid(x,y) Next Next CloseFile file SetBuffer BackBuffer() Type tank Field x#,y#,clr,hp,dir,go,ai,change,aix,aiy,fire End Type Type bullet Field x,y,dir,time End Type Global alive=1 Const red=1,green=2,blue=3,yellow=4 Const N=0,E=1,S=2,W=3 Const north=0,east=1,south=2,west=3,point=4,still=5 For do=1 To 4 t.tank=New tank If do=1 Then t\x=0:t\y=0 Else If do=2 t\x=31:t\y=0 Else If do=3 Then t\x=31:t\y=31 Else If do=4 t\x=0:t\y=31 t\hp=6 t\clr=(do-1)*4 frame=do+1 If frame=5 Then frame=1 t\dir=(frame-1) Next Repeat alive=0 ais=0 Cls DrawImage map,0,0 For b.bullet=Each bullet die=0 b\time=b\time+1 Color 0,0,0 Oval b\x-2,b\y-2,4,4 Select b\dir Case n:b\y=b\y-10 Case e:b\x=b\x+10 Case s:b\y=b\y+10 Case w:b\x=b\x-10 End Select For t.tank=Each tank If RectsOverlap(t\x*16,t\y*16,16,16,b\x,b\y,4,4) Then t\hp=t\hp-1:die=1 Next If b\time>=16 Then die=1 EndIf If die=1 Then Delete b Next For t.tank=Each tank If t\hp=<0 Then Delete t:Exit If t\x<0 Then t\x=0 Else If t\x>31 Then t\x=31 If t\y<0 Then t\y=0 Else If t\y>31 Then t\y=31 lastx=t\x:lasty=t\y DrawImage tank,t\x*16,t\y*16,t\clr+t\dir Color 0,0,0 Rect t\x*16-4,t\y*16-4,6*4,2 Color 0,255,0 Rect t\x*16-4,t\y*16-4,t\hp*4,2 If t\clr=0 Then If t\fire=0 Then If KeyDown(57) Then Select t\dir Case n:bullet(t\x*16+8,t\y*16+8-20,t\dir):t\fire=30 Case s:bullet(t\x*16+8,t\y*16+8+20,t\dir):t\fire=30 Case e:bullet(t\x*16+8+20,t\y*16+8,t\dir):t\fire=30 Case w:bullet(t\x*16+8-20,t\y*16+8,t\dir):t\fire=30 End Select EndIf Else t\fire=t\fire-1 EndIf alive=1 If t\go=0 Then If KeyDown(200) Then t\y=t\y-1:t\dir=n Else If KeyDown(208) Then t\y=t\y+1:t\dir=s Else If KeyDown(203) Then t\x=t\x-1:t\dir=w Else If KeyDown(205) Then t\x=t\x+1:t\dir=e If t\x<0 Then t\x=0 Else If t\x>31 Then t\x=31 If t\y<0 Then t\y=0 Else If t\y>31 Then t\y=31 If grid(t\x,t\y)=5 Then t\x=lastx:t\y=lasty If grid(t\x,t\y)=0 Then t\go=10 If grid(t\x,t\y)=1 Then t\go=15 If grid(t\x,t\y)=2 Then t\go=20 If grid(t\x,t\y)=3 Then t\go=25 If grid(t\x,t\y)=4 Then t\go=30 Else t\go=t\go-1 EndIf Else If t\fire=0 Then Select t\dir Case n:bullet(t\x*16+8,t\y*16+8-20,t\dir):t\fire=Rand(20,120) Case s:bullet(t\x*16+8,t\y*16+8+20,t\dir):t\fire=Rand(20,120) Case e:bullet(t\x*16+8+20,t\y*16+8,t\dir):t\fire=Rand(20,120) Case w:bullet(t\x*16+8-20,t\y*16+8,t\dir):t\fire=Rand(20,120) End Select Else t\fire=t\fire-1 EndIf t\change=t\change-1 If t\change<=0 Then t\ai=Rand(0,5):t\change=Rand(60,180):If t\ai=4 Then t\aix=Rand(0,31):t\aiy=Rand(0,31) If t\go=0 Then Select t\ai Case 0:t\y=t\y-1:t\dir=n Case 1:t\x=t\x+1:t\dir=e Case 2:t\y=t\y+1:t\dir=s Case 3:t\x=t\x-1:t\dir=w Case 4:If t\x>t\aix Then t\x=t\x-1:t\dir=w Else If t\xt\aiy Then t\y=t\y-1:t\dir=n Else If t\y31 Then t\x=31 If t\y<0 Then t\y=0 Else If t\y>31 Then t\y=31 If grid(t\x,t\y)=5 Then t\x=lastx:t\y=lasty If grid(t\x,t\y)=0 Then t\go=10 If grid(t\x,t\y)=1 Then t\go=15 If grid(t\x,t\y)=2 Then t\go=20 If grid(t\x,t\y)=3 Then t\go=25 If grid(t\x,t\y)=4 Then t\go=30 Else t\go=t\go-1 EndIf EndIf Next If alive=0 Then Cls Repeat Cls Color 255,255,0 Text 256,256,"GAME OVER",1,1 Flip If KeyDown(1) Then End Forever EndIf For t.tank=Each tank If t\clr>0 Then ais=ais+1 Next If ais=0 Then Cls Repeat Cls Color 255,255,0 Text 256,256,"CONGRATULATIONS; YOU WIN!",1,1 Flip If KeyDown(1) Then End Forever EndIf Flip Until KeyDown(1) End Function bullet(x,y,dir) b.bullet=New bullet b\x=x:b\y=y:b\dir=dir End Function[/code]

[code]; ----------------------------------- ; -- Title : Photoscramble -- ; -- Author : Bas de Reuver -- ; -- Date : 31 dec 2002 -- ; ----------------------------------- ; ; Photoscramble is the well-known 15Puzzle written in Blitzbasic. It uses any ; .BMP picture as puzzle background, gridsize can be from 2x2 upto anything ; (although 8x8 and up is not very playable). Player uses mouse or cursorkeys ; to slide the squares around to reconstruct the picture. ; ; A lot of other 15Puzzle-clones do not check if a scrambled puzzle is ; solvable, yet this is very important and relatively easy to do. See the ; function CheckPuzzleSolvable() for more details. ; constants Const c_GridMin = 3 Const c_GridMax = 15 ; array for all available picture files Dim PicturesList$(39) ;4*10-1 Global SlideSound Global CompletedSound ; game settings user defined Global Picture$ Global PlayGridSize = 4 Global GridSquare Global ScreenGridSize Global PieceXsize Global PieceYsize Global PuzzlePieces Global HolePiece Global HolePieceLocation Global NumberOfMoves Global PuzzleCompleted Global MouseCursor Global TitlePicture Global GridYesNo = 0 ; 0=false, 1=true Global NumbersYesNo = 1 ; 0=false, 1=true Global FullscreenYesNo = 1 ; 0=false, 1=true If Not (CheckAllFiles() = 1) Then End: ; array with scrambled puzzle Dim Puzzle(c_GridMax*c_GridMax) Dim PuzzleSolved(c_GridMax*c_GridMax) InitialiseMenuGraphics() Global ColorDepth = GraphicsDepth() ; use current colordepth Repeat ; switch to 640 x 480 If (GraphicsWidth() <> 640) Or (GraphicsHeight() <> 480) Then InitialiseMenuGraphics() EndIf ClsColor 0, 0, 192 ; blue background RetrievePictures() Repeat ; draw to the back buffer SetBuffer BackBuffer() Cls ; draw everything i = DisplayMenu() ; flip back buffer to screen Flip Until i <> -1 If i = -2 Then End: If (InitializePuzzle(i) = 1) Then ScramblePuzzle() ClsColor 0, 0, 0 ; black background ; keep looping until ESC pressed Repeat ; draw to the back buffer SetBuffer BackBuffer() Cls ; draw everything RenderPuzzle() RenderPlayer() ; handle input from player KeyboardInput() MouseInput() ; flip back buffer to screen Flip Until KeyDown(1) Or (PuzzleCompleted = 1) ; if completed play sound and show picture If (PuzzleCompleted = 1) Then ; show completed picture RenderPuzzleCompleted() ; playsound and wait for any key FlushKeys() PlaySound CompletedSound WaitKey() End If ; player pressing ESC to quit game or end-screen, wait until ESC-key released Repeat Until Not KeyDown(1) End If Forever ;End: ; -------------------------------------- ; -- check if for cursor and title -- ; -- bitmaps, and slide and complete -- ; -- sounds -- ; -- return 0 some/all files missing -- ; -- 1 all files found -- ; -------------------------------------- Function CheckAllFiles() ; temporary function result, assume no files missing strTemp$ = "" If FileSize("photoscramble_cursor.bmp") = 0 Then ; for displaying error message to user If (strTemp$ <> "") Then strTemp$ = strTemp$ + ", " strTemp$ = strTemp$ + "photoscramble_cursor.bmp" ; picture will be loaded in function InitialiseMenuGraphics() End If If FileSize("photoscramble_title.bmp") = 0 Then ; for displaying error message to user If (strTemp$ <> "") Then strTemp$ = strTemp$ + ", " strTemp$ = strTemp$ + "photoscramble_title.bmp" ; picture will be loaded in function InitialiseMenuGraphics() End If If FileSize("photoscramble_slide.wav") = 0 Then ; for displaying error message to user If (strTemp$ <> "") Then strTemp$ = strTemp$ + ", " strTemp$ = strTemp$ + "photoscramble_slide.wav" Else ; load sound effect SlideSound = LoadSound("photoscramble_slide.wav") End If If FileSize("photoscramble_completed.wav") = 0 Then ; for displaying error message to user If (strTemp$ <> "") Then strTemp$ = strTemp$ + ", " strTemp$ = strTemp$ + "photoscramble_completed.wav" Else ; load sound effect CompletedSound = LoadSound("photoscramble_completed.wav") End If ; set function result If (strTemp$ = "") Then Return 1 Else ; display error message about missing files Print "The following files are needed, but were not found." Print "" Print strTemp$ Print "" Print "press any key to quit.." ; for for keypress WaitKey() Return 0 End If End Function ; -------------------------------------- ; -- initialize menu graphics stuff -- ; -------------------------------------- Function InitialiseMenuGraphics() ; only switch when needed Graphics 640, 480;, ColorDepth, FullscreenYesNo ; note: pictures can only be reloaded, when graphics mode was set. ; When resolution changed, reload pictures else "Image does not exsist" error MouseCursor = LoadImage("photoscramble_cursor.bmp") TitlePicture = LoadImage("photoscramble_title.bmp") ; TitlePicture = LoadImage("test.bmp") ; set transparancy for mouse cursor, only possible with BMP files MaskImage MouseCursor, 255, 0, 255 End Function ; -------------------------------------- ; -- initialize and scamble puzzle -- ; -------------------------------------- Function InitializePuzzle(Selected) ; game settings user defined Picture$ = PicturesList$(Selected) ; PlayGridSize = 4 GridSquare = PlayGridSize*PlayGridSize ScreenGridSize = PlayGridSize + 2 ; determine optimum screen size ; 1 = 640x480 ; 2 = 800x600 ; 3 = 1024x768 ; 4 = 1280x1024 ;-1 no optimum screen size, picture too large testLoadImage = LoadImage(Picture$) xSize = ImageWidth(testLoadImage) ySize = ImageHeight(testLoadImage) iGraphicsMode = -1 ; normally pictures y/x = 3/4 If ((ySize/xSize) <= 0.75) Then ; xSize (width) determines optimum screen size If (xSize <= 1280) Then iGraphicsMode = 4 If (xSize <= 1024) Then iGraphicsMode = 3 If (xSize <= 800) Then iGraphicsMode = 2 If (xSize <= 640) Then iGraphicsMode = 1 Else ; ySize (height) determines optimum screen size If (ySize <= 1024) Then iGraphicsMode = 4 If (ySize <= 768) Then iGraphicsMode = 3 If (ySize <= 600) Then iGraphicsMode = 2 If (ySize <= 480) Then iGraphicsMode = 1 End If ; is it possible to find a correct working video mode CorrectGraphics = 1 ; 0=false, 1=true ; switch to graphics mode Select iGraphicsMode Case 1 ; switch to 640 x 480 only when needed If (GraphicsWidth() <> 640) Or (GraphicsHeight() <> 480) Then ; 640 x 480 should always be possible ; If (GfxModeExists(640, 480, ColorDepth) = 1) Then ;GfxModeExists doesn't seem to work correct Graphics 640, 480;, ColorDepth, FullscreenYesNo ; Else ; CorrectGraphics = 0 ; 0=false, 1=true ; EndIf End If Case 2 ; switch to 800 x 600 only when needed If (GraphicsWidth() <> 800) Or (GraphicsHeight() <> 600) Then ; check if 800 x 600 is possible ; If (GfxModeExists (800, 600, ColorDepth) = 1) Then ;GfxModeExists doesn't seem to work correct Graphics 800, 600;, ColorDepth, FullscreenYesNo ; Else ; CorrectGraphics = 0 ; 0=false, 1=true ; End If End If Case 3 ; switch to 1024 x 768 only when needed If (GraphicsWidth() <> 1024) Or (GraphicsHeight() <> 768) Then ; check if 1024 x 768 is possible ; If (GfxModeExists (1024, 768, ColorDepth) = 1) Then ;GfxModeExists doesn't seem to work correct Graphics 1024, 768;, ColorDepth, FullscreenYesNo ; Else ; CorrectGraphics = 0 ; 0=false, 1=true ; End If End If Case 4 ; switch to 1280 x 1024 only when needed If (GraphicsWidth() <> 1280) Or (GraphicsHeight() <> 1024) Then ; check if 1280 x 1024 is possible ; If (GfxModeExists (1280, 1024, ColorDepth) = 1) Then ;GfxModeExists doesn't seem to work correct Graphics 1280, 1024;, ColorDepth, FullscreenYesNo ; Else ; CorrectGraphics = 0 ; 0=false, 1=true ; End If End If Default ; resolution of this picture is too large CorrectGraphics = 0 ; 0=false, 1=true End Select ; if no graphics mode could be set for this picture If (CorrectGraphics = 0) Then ; switch back to 640 x 480 if needed ; If (GraphicsWidth() <> 640) Or (GraphicsHeight() <> 480) Then ; InitialiseMenuGraphics() ; EndIf Cls If (iGraphicsMode = -1) ; picture is too large strTemp$ = "("+xSize+"x"+ySize+")" ShadowText(50, 220, "The resolution of this picture is too large "+strTemp$) ShadowText(50, 220+14, "Recommended picture resolutions are") ShadowText(50, 220+28, "640x480, 800x600, 1024x768 and 1280x1024") Else ; could not set graphics mode for this picture Select iGraphicsMode Case 1: strTemp = "640x480" Case 2: strTemp = "800x600" Case 3: strTemp = "1024x768" Case 4: strTemp = "1280x1024" End Select strTemp = "Your videocard could not switch to the graphics mode " + strTemp$ ShadowText(50, 220, strTemp$) strTemp$ = xSize + "x" + ySize ShadowText(50, 220+14, " which is needed for this picture ("+strTemp$+")") End If ShadowText(250, 220+56, "press any key..") Flip WaitKey Return 0 End If ; When resolution changed, reload pictures else "Image does not exsist" error MouseCursor = LoadImage("photoscramble_cursor.bmp") ; set transparancy for mouse cursor, only possible with BMP files MaskImage MouseCursor, 255, 0, 255 PieceXsize = xSize/ScreenGridSize PieceYsize = ySize/ScreenGridSize ; note: LoadAnimImage only takes .BMP's not .JPG's, error occures when DrawImage or DrawBlock is called PuzzlePieces = LoadAnimImage(Picture$, PieceXsize, PieceYsize, 0, ScreenGridSize*ScreenGridSize) Return 1 End Function ; -------------------------------------- ; -- initialize and scamble puzzle -- ; -------------------------------------- Function ScramblePuzzle() ; fill SolvedPuzzle array with numbers of the picture-frames in the middle ; for example with a 3*3 puzzle: ; 0 1 2 3 4 ; +--------+ ; 5| 6 7 8| 9 ; 10|11 12 13|14 ; 15|16 17 18|19 ; +--------+ ; 20 21 22 23 24 ; ; the pieces 1, 2, 3 etc. are the frame border ; the pieces 7, 8, 9 etc. are the puzzle pieces i = ScreenGridSize + 1 For y = 1 To PlayGridSize For x = 1 To PlayGridSize ; PuzzleSolved holds puzzle pieces from the middle-square PuzzleSolved(((y-1)*PlayGridSize)+x) = i i = i + 1 Next i = i + 2 Next ; fill Puzzle array with numbers 1..PlayGridSize*PlayGridSize(=GridSquare) For i = 1 To GridSquare ; the player manipulates this array Puzzle(i) = i Next ; randomize (scamble) the Puzzle array SeedRnd MilliSecs() For i = 1 To 10*GridSquare LocationA = Rnd(1, GridSquare-1) LocationB = Rnd(1, GridSquare-1) ; take the puzzle pieces at those locations a = Puzzle(LocationA) b = Puzzle(LocationB) ; switch the puzzle pieces Puzzle(LocationA) = b Puzzle(LocationB) = a Next CheckPuzzleSolvable() ; hole piece HolePiece = GridSquare ; put current location of holepiece in HolePieceLocation For i = 1 To GridSquare If (Puzzle(i) = HolePiece) Then HolePieceLocation = i Next ; reset game variables NumberOfMoves = 0 PuzzleCompleted = 0 ; 0=false, 1=true End Function ; -------------------------------------- ; -- render entire picture -- ; -------------------------------------- Function RenderPuzzle() ; top border For x = 0 To ScreenGridSize-1 DrawImage PuzzlePieces, x*PieceXsize, 0, x Next ; left and right border For y = 1 To ScreenGridSize-2 ; left DrawImage PuzzlePieces, 0, y*PieceYsize, y*ScreenGridSize ; right DrawImage PuzzlePieces, (ScreenGridSize-1)*PieceXsize, y*PieceYsize, (y+1)*ScreenGridSize-1 Next ; bottom border For x = 0 To ScreenGridSize-1 DrawImage PuzzlePieces, x*PieceXsize, (ScreenGridSize-1)*PieceYsize, ((ScreenGridSize-1)*ScreenGridSize)+x Next ; render puzzle parts of picture For y = 1 To PlayGridSize For x = 1 To PlayGridSize ; puzzle piece (from functional perspective, 1..PlayGridSize*PlayGridSize(=GridSquare) ) Piece = Puzzle(((y-1)*PlayGridSize)+x) If (Piece = HolePiece) Then ; draw a black box, representing the hole ; DrawImage PuzzlePieces, x*PieceXsize, y*PieceYsize, i Else ; puzzle piece (from graphical perspective) i = PuzzleSolved(Piece) DrawImage PuzzlePieces, x*PieceXsize, y*PieceYsize, i ; display numbers If (NumbersYesNo = 1) Then ShadowText(x*PieceXsize, y*PieceYsize, Piece) End If End If Next Next ; draw a grid If (GridYesNo = 1) Then ; horizontal lines Start1 = PieceXsize Start2 = PieceXsize*(ScreenGridSize-1) For y = 1 To ScreenGridSize-1 ; white lines Color 255, 255, 255 Line Start1, y*PieceYsize, Start2, y*PieceYsize ; black lines Color 0, 0, 0 Line Start1, 1+(y*PieceYsize), Start2, 1+(y*PieceYsize) Next ; vertical lines Start1 = PieceYsize Start2 = PieceYsize*(ScreenGridSize-1) For x = 1 To ScreenGridSize-1 ; white lines Color 255, 255, 255 Line x*PieceXsize, Start1, x*PieceXsize, Start2 ; white lines Color 0, 0, 0 Line 1+(x*PieceXsize), Start1, 1+(x*PieceXsize), Start2 Next End If End Function ; -------------------------------------- ; -- render completed puzzle picture -- ; -------------------------------------- Function RenderPuzzleCompleted() ;set backbuffer and clear SetBuffer BackBuffer() Cls ; draw entire image For y = 0 To ScreenGridSize-1 For x = 0 To ScreenGridSize-1 DrawImage PuzzlePieces, x*PieceXsize, y*PieceYsize, (y*ScreenGridSize)+x Next Next ; display all onscreen text ShadowText(2, 2, "Photoscramble") ShadowText(2, 2+14, "BdRİ2002") ShadowText(2, 2+28, "Moves: " + NumberOfMoves) ShadowText(2, 2+42, "Press any key..") ; display virtual screen Flip End Function ; -------------------------------------- ; -- render player cursor and status -- ; -------------------------------------- Function RenderPlayer() ; only draw mouse cursor when in full screen If (FullscreenYesNo = 1) Then MouseXPos = MouseX() MouseYPos = MouseY() DrawImage MouseCursor, MouseXPos, MouseYPos End If ; display all onscreen text ShadowText(2, 2, "Photoscramble") ShadowText(2, 2+14, "BdRİ2002") ShadowText(2, 2+28, "Moves: " + NumberOfMoves) End Function ; -------------------------------------- ; -- act on keyboard input -- ; -------------------------------------- Function KeyboardInput() WaitForKeyCode = -1 ; cursor up If KeyDown(200) Then If (ManipulatePuzzle(1) = 1) Then WaitForKeyCode = 200 End If ; cursor down If KeyDown(208) Then If (ManipulatePuzzle(2) = 1) Then WaitForKeyCode = 208 End If ; cursor left If KeyDown(203) Then If (ManipulatePuzzle(3) = 1) Then WaitForKeyCode = 203 End If ; cursor right If KeyDown(205) Then If (ManipulatePuzzle(4) = 1) Then WaitForKeyCode = 205 End If ; NumPad 8 (up) If KeyDown(72) Then If (ManipulatePuzzle(1) = 1) Then WaitForKeyCode = 72 End If ; NumPad 2 (down) If KeyDown(80) Then If (ManipulatePuzzle(2) = 1) Then WaitForKeyCode = 80 End If ; NumPad 4 (left) If KeyDown(75) Then If (ManipulatePuzzle(3) = 1) Then WaitForKeyCode = 75 End If ; NumPad 6 (right) If KeyDown(77) Then If (ManipulatePuzzle(4) = 1) Then WaitForKeyCode = 77 End If ; G - Toggle grid If KeyDown(34) Then ; 0=false, 1=true If (GridYesNo = 0) Then GridYesNo = 1 Else GridYesNo = 0 End If WaitForKeyCode = 34 End If ; N - Toggle numbers If KeyDown(49) Then ; 0=false, 1=true If (NumbersYesNo = 0) Then NumbersYesNo = 1 Else NumbersYesNo = 0 End If WaitForKeyCode = 49 End If ; if a key was pressed wait for user to release that key If (WaitForKeyCode <> -1) Then Repeat Until Not KeyDown(WaitForKeyCode) ; not N or G then make sliding sound If (WaitForKeyCode <> 34) And (WaitForKeyCode <> 49) Then PlaySound SlideSound CheckPuzzleCompleted() End If End If End Function ; --------------------------------------; -- act on mouse input -- ; -------------------------------------- Function MouseInput() ; if not any mouse button pressed exit function If Not (MouseDown(1) Or MouseDown(2) Or MouseDown(3)) Then Return 0 ; check if mouse cursor within puzzle grid (not on the border frame) x = MouseX() - PieceXsize y = MouseY() - PieceYsize ; cursor is outside playing area (left or top), exit this function If (x < 0) Or (y < 0) Then Return 0 ; 'translate' x and y to grid coordinates x = x / PieceXsize y = y / PieceYsize ; cursor is outside playing area (right or bottom), exit this function If (x > PlayGridSize-1) Or (y > PlayGridSize-1) Then Return 0 ClickedLocation = (y*PlayGridSize)+x+1 MoveCode = -1 ; player clicked in the same vertical column as where the HolePiece is located If ((ClickedLocation Mod PlayGridSize) = (HolePieceLocation Mod PlayGridSize)) Then ; player clicked on tile that is somewhere below the HolePiece If (ClickedLocation > HolePieceLocation) Then ; move pieces up y = Abs((ClickedLocation - HolePieceLocation) / PlayGridSize) MoveCode = 1 ;up End If ; player clicked on tile that is somewhere above the HolePiece If (ClickedLocation < HolePieceLocation) Then ; move pieces down y = Abs((ClickedLocation - HolePieceLocation) / PlayGridSize) MoveCode = 2 ;down End If End If ; player clicked in the same horizontal row as where the HolePiece is located If (((ClickedLocation-1) / PlayGridSize) = ((HolePieceLocation-1) / PlayGridSize)) Then ; player clicked on tile that is somewhere to the right of the HolePiece If (ClickedLocation > HolePieceLocation) Then ; move pieces to left y = Abs(ClickedLocation - HolePieceLocation) MoveCode = 3 ;left End If ; player clicked on tile that is somewhere to the left of the HolePiece If (ClickedLocation < HolePieceLocation) Then ; move pieces to right y = Abs(ClickedLocation - HolePieceLocation) MoveCode = 4 ;right End If End If ; player clicked on a valid location If (MoveCode <> -1) Then ; then apply the neccecery moves For x = 1 To y ManipulatePuzzle(MoveCode) Next ; play sound and check if puzzle is solved now PlaySound SlideSound CheckPuzzleCompleted() End If End Function ; -------------------------------------- ; -- manipulate the puzzle array -- ; -- input: MoveCode = 1, move up -- ; -- MoveCode = 2, move down -- ; -- MoveCode = 3, move left -- ; -- MoveCode = 4, move right -- ; -- -- ; -- output: 1 (true) move was valid -- ; -- 0 (false) move not valid -- ; -------------------------------------- Function ManipulatePuzzle(MoveCode) ; initialise function result, false MovePiece = -1 Select MoveCode ; move up Case 1 If (HolePieceLocation <= (PlayGridSize-1)*PlayGridSize) Then ; switch HolePiece with the tile under it MovePiece = HolePieceLocation + PlayGridSize End If ; move down Case 2 If (HolePieceLocation > PlayGridSize) Then ; switch HolePiece with the tile above it MovePiece = HolePieceLocation - PlayGridSize End If ; move left Case 3 If ((HolePieceLocation Mod PlayGridSize) <> 0) Then ; switch HolePiece with the tile to the right of it MovePiece = HolePieceLocation + 1 End If ; move right Case 4 If (((HolePieceLocation-1) Mod PlayGridSize) <> 0) Then ; switch HolePiece with the tile to the left of it MovePiece = HolePieceLocation - 1 End If End Select ; switch HolePiece with another tile If (MovePiece <> -1) Then ; move the piece on the HolePiece Puzzle(HolePieceLocation) = Puzzle(MovePiece) ; update HolePiece variables HolePieceLocation = MovePiece Puzzle(HolePieceLocation) = HolePiece ; keep track of number of moves NumberOfMoves = NumberOfMoves + 1 ; valid move, function result = 1 Return 1 Else ; not a valid move, function result = 0 Return 0 End If End Function ; -------------------------------------- ; -- check if puzzle is completed, -- ; -- set variable PuzzleCompleted -- ; -- accordingly, 0=false, 1=true -- ; -------------------------------------- Function CheckPuzzleCompleted() ; assume the puzzle is solved PuzzleCompleted = 1 ; if Puzzle array completely solved, then it should be 1, 2, 3 etc. again For i = 1 To GridSquare ; if puzzle is not solved If (Puzzle(i) <> i) Then ; set variable to 0=false PuzzleCompleted = 0 End If Next End Function ; -------------------------------------- ; -- check if puzzle is solvable, -- ; -- Important: Because the hole is -- ; -- represented by the highest piece -- ; -- number, it *must* at the end -- ; -- position (last position in array)-- ; -- for this function to work. -- ; -- If unsolvable, fix it -- ; -------------------------------------- Function CheckPuzzleSolvable() ; the puzzle is only solvable, if an even number of inversions (switches) is needed to solve it. ; Count the number of pairs where a bigger number is in front of a smaller one (inversions). ; For example in a 3x3 puzzle: ; 5 3 4 ; 2 6 1 ; 8 7 ; in array (534261879) -> count pairs 53 54 52 51, 32 31, 42 41, 21, 61, 87 => 11 pairs, ; 11 inversions are needed, this is not an even number, thus this configuration is unsolvable. ; count how many times a bigger number is in front of a smaller one NumberOfInversions = 0 For i = 1 To GridSquare-1 For j = i+1 To GridSquare If (Puzzle(i) > Puzzle(j)) Then NumberOfInversions = NumberOfInversions + 1 End If Next Next ; if NumberOfInversions is not an even number If ((NumberOfInversions Mod 2) <> 0) Then ; the puzzle is unsolvable, the number of switches is odd. ; Simply make one more switch and it's and even number. i = Puzzle(1) Puzzle(1) = Puzzle(2) Puzzle(2) = i End If End Function ; -------------------------------------- ; -- retrieve all bmp files, put -- ; -- filenames in array PicturesList$ -- ; -------------------------------------- Function RetrievePictures() Counter = 0 ; Define what folder to start with ... Folder$=CurrentDir$() ; Open up the directory, and assign the handle to myDir myDir=ReadDir(Folder$) ; Let's loop forever until we run out of files/folders to list! Repeat ; Assign the next entry in the folder to file$ Filename$=NextFile$(myDir) If (Filename <> "") Then ; FileType determines if it is a file (value 1) or a folder (value 2) If FileType(Filename$) = 1 Then ; check file extension Ext$ = "" For i = Len(Filename$) To 1 Step -1 If Mid$(Filename$, i, 1) = "." Then Ext$ = Right$(Filename$, Len(Filename$) - i):Exit Next ; only keep .BMP's If (Lower$(Ext$) = "bmp") And (Counter <= 39) Then ; ignore cursor and title picture If (Lower$(Filename$) <> "photoscramble_cursor.bmp") And (Lower$(Filename$) <> "photoscramble_title.bmp") Then PicturesList$(Counter) = Filename$ Counter = Counter + 1 End If End If End If End If ; If there isn't another one, let's exit this loop Until Filename$="" ; Properly close the open folder CloseDir myDir ; function result = number of files Return Counter End Function ; -------------------------------------- ; -- render entire menu -- ; -- return -1 no user action -- ; -- -2 user want to quit -- ; -- other, PicturesList$ index-- ; -------------------------------------- Function DisplayMenu() ; draw mouse cursor MouseXPos = MouseX() MouseYPos = MouseY() Selected = -1 If (MouseYPos > 340) Then x = MouseXPos / 160 y = (MouseYPos - 340) / 14 ; cursor is outside playing area (right or bottom), exit this function Selected = y+(x*10) End If ; display options + instructions DisplayOptions() ; draw all available files DisplayPictures(Selected) ; only draw mouse cursor when in full screen If (FullscreenYesNo = 1) Then DrawImage MouseCursor, MouseXPos, MouseYPos End If ; if not mouse clicked set function result to -1 If Not (MouseDown(1) Or MouseDown(2) Or MouseDown(3)) Then Selected = -1 Else ; user clicked but not in files-part If (Selected <> -1) Then ; if user clicked on an square with no filename If (PicturesList$(Selected) = "") Then Selected = -1 End If End If ; if ESC pressed, set function result to -2 If (KeyDown(1) = True) Then Selected = -2 Return Selected End Function ; -------------------------------------- ; -- display the caption of menupart -- ; -------------------------------------- Function MenuHeader(Caption$, yPos) ; draw a rectangle Color 255, 255, 255 Rect 0, yPos, 160, 14, 1 Line 0, yPos+13, 640, yPos+13 ; display menupart caption Color 0, 0, 192 Text 16, yPos-1, Caption$ End Function ; -------------------------------------- ; -- print a text with 'shadow' -- ; -------------------------------------- Function ShadowText(x, y, Text$) ; black (shadow) Color 0, 0, 0 Text x+1, y+1, Text$ ; white ; white Color 255, 255, 255 Text x, y, Text$ End Function ; -------------------------------------- ; -- display option + instructions -- ; -------------------------------------- Function DisplayOptions() ; display title header DrawImage TitlePicture, 0, 0 ; instructions MenuHeader("Instructions", 96) ShadowText(16, 96+14, "Photoscramble consists of puzzle pieces in a square box. The goal is") ShadowText(16, 96+28, "to reconstruct the picture. You can slide the pieces around using") ShadowText(16, 96+42, "the mouse or the cursor keys.") ShadowText(16, 96+70, "You can select the options below by pressing the indicated keys.") ShadowText(16, 96+84, "During the game press G and N to toggle grid and numbers, ESC exits.") ShadowText(16, 96+112, "Start the game by selecting a picture at the bottom of the screen or") ShadowText(16, 96+126, "press ESC to quit. Game programmed in BlitzBasic by Bas de Reuver.") ; options MenuHeader("Options", 254) ShadowText(16, 254+14, "+ - Grid size:") ShadowText(16, 254+28, " G Display grid:") ShadowText(16, 254+42, " N Display numbers:") ; ShadowText(16, 254+56, " F Fullscreen") ShadowText(260, 254+14, PlayGridSize + " x " + PlayGridSize) If (GridYesNo = 1) Then strTemp$ = "Yes" Else strTemp$ = "No" ShadowText(260, 254+28, strTemp$) If (NumbersYesNo = 1) Then strTemp$ = "Yes" Else strTemp$ = "No" ShadowText(260, 254+42, strTemp$) ; If (FullscreenYesNo = 1) Then strTemp$ = "Yes" Else strTemp$ = "No" ; ShadowText(260, 254+56, strTemp$) WaitForKeyCode = -1 ; - minus (keyboard), descrease grid size If KeyDown(12) Then PlayGridSize = PlayGridSize - 1 WaitForKeyCode = 12 End If ; + plus (keyboard), increase grid size If KeyDown(13) Then PlayGridSize = PlayGridSize + 1 WaitForKeyCode = 13 End If ; - minus (keypad), descrease grid size If KeyDown(74) Then PlayGridSize = PlayGridSize - 1 WaitForKeyCode = 74 End If ; + plus (keypad), increase grid size If KeyDown(78) Then PlayGridSize = PlayGridSize + 1 WaitForKeyCode = 78 End If ; boundaries for grid size If (PlayGridSize < c_GridMin) Then PlayGridSize = c_GridMin If (PlayGridSize > c_GridMax) Then PlayGridSize = c_GridMax ; G - Toggle grid If KeyDown(34) Then ; 0=false, 1=true If (GridYesNo = 0) Then GridYesNo = 1 Else GridYesNo = 0 WaitForKeyCode = 34 End If ; N - Toggle numbers If KeyDown(49) Then ; 0=false, 1=true If (NumbersYesNo = 0) Then NumbersYesNo = 1 Else NumbersYesNo = 0 WaitForKeyCode = 49 End If ; F - Toggle windowed/fullscreen, not available in BlitzBasic 1.24 ; If KeyDown(33) Then ; 0=false, 1=true ; If (FullscreenYesNo = 0) Then FullscreenYesNo = 1 Else FullscreenYesNo = 0 ; switch screen mode windowed/fullscreen ; InitialiseMenuGraphics() ; ClsColor 0, 0, 192 ; blue background ; WaitForKeyCode = 34 ; End If ; if a key was pressed wait for user to release that key If (WaitForKeyCode <> -1) Then Repeat Until Not KeyDown(WaitForKeyCode) End If End Function ; -------------------------------------- ; -- display all available files -- ; -- input: Selected = mousecursor is -- ; -- over this square -- ; -------------------------------------- Function DisplayPictures(Selected) MenuHeader("Select picture", 340-14) For x = 0 To 3 For y = 1 To 10 i = x*10+y-1 ; draw a yellow square around selected picture If (i = Selected) Then Color 255, 255, 0 ; yellow ; draw a rectangle Rect x*160, 340-14+y*14, 160, 14, 1 End If ; display filename ShadowText(x*160, 340-16+y*14, PicturesList$(i)) Next Next End Function[/code]

Ooh, ooh, this one's by you, mike_g! (Not to diss the quality of the final product or anything, which actually turned out very nice)

[code]Graphics 1024, 768 SetBuffer BackBuffer() framerate = CreateTimer(60) ;***************************************************************************************************** Include "Level 1\Level 1.bb" Include "Level 2\Level 2.bb" Include "Level 3\Level 3.bb" ;******************************************************************************************************* ;--------------------------------DECLARE VARIABLES------------------------------------------------------ ;TITLE-----------* Global hilite, name_enter ;-----------------* Global state, world_timer ;PLAYER-----------* Global x_pos, y_pos Global lives, speed,bombs, warp, max_speed Global gun_1, gun_2, gun_3, gun_4, gun_2dir, gun_3dir Global charge, charged Const max_charge = 80 Global pod, degrees, invincible,i_set, jinx Global guncount,rocketcount, backcount, backframe Global player_dead, dead_count, wave, level, score ;-----------------* Global distance, angle#, direct Global rockcount, rocknum Global boss_start, degrees2, orbdist, drawback Global colormod, high_score, wavecounter, wavebit Global xm, ym, dirm, spdm Global boss_max_hp, boss_height, boss_width ;LOAD HISCORES----* Dim hiscore(9) Dim name$(9) readdat = ReadFile("Hi_Scores_Test.dat") For i = 0 To 8 name$(i) = ReadLine(readdat) hiscore(i) = ReadLine(readdat) If hiscore(i) > high_score Then high_score = hiscore(i) Next ;-----------------* ;ROCKBLAST VARIABLES Global oldtime, wavetime, time_bonus, point_bonus ;-----------------* ;POWERUP NAMES----* Dim p_string$(16) p_string$(0)="SPEED UP": p_string$(1)="SCORE BONUS": p_string$(2)="SIDE CANNON" p_string$(3)="SIDE MISSILE": p_string$(4)="SIDE WAVE": p_string$(5)="WARP CANNON" p_string$(6)="ORBITAL SHIELD": p_string$(7)="FIREPOWER": p_string$(8)="REAR SHOT" p_string$(9)="REAR WAVE": p_string$(10)="MEGA BOMB": p_string$(11)="INVULNERABILITY" p_string$(12)="JINX": p_string$(13)="EXTRA LIFE": p_string$(14)="BOMB PACK" p_string$(15)="EXTRA WARP" ;-----------------* ;CREATE TYPES-----* Type shot Field x, y, dir,dam, spd, id, shot_by, timer End Type Type pod Field x, y, hp End Type Type rock Field x, y, dir, spd, hp, id, num, been_hit End Type Type alien Field x, y, dir, spd, hp, id, timer, timer2, route, points, been_hit End Type Type powerup Field x, y, id, timer End Type Type score Field x, y, time, value End Type Type boss Field x, y, hp, id, dir, spd, counter1, counter2, counter3, counter4, counter5, points End Type Type b_orb Field x,y, dir, spd End Type Type explode Field x, y, frame, counter End Type Type wall Field x, y End Type ;-----------------* ;LOAD IMAGES------* Global sprites = LoadAnimImage ("Graphics\Sprites.bmp", 32, 32, 0, 8) ;load sprites. Global pods = LoadAnimImage("Graphics\Pod.bmp", 16, 16, 0, 4) Global rocks = LoadAnimImage("Graphics\Rocks.bmp", 32, 32, 0, 32) Global bigrocks = LoadAnimImage("Graphics\Big_Rocks.bmp", 64, 64, 0, 4) Global aliens = LoadAnimImage("Graphics\Aliens.bmp", 32, 32, 0, 32) Global shots = LoadAnimImage ("Graphics\Shots.bmp", 8, 8, 0, 32) ;load shots. Global bigshots = LoadAnimImage ("Graphics\Big_Shots.bmp", 32, 32, 0, 32) Global powerup = LoadAnimImage("Graphics\Powerup.bmp", 16, 16, 0, 16) ;load powerups. Global upgrade = LoadAnimImage("Graphics\Upgrades.bmp", 16, 16, 0, 8) ;load upgrades. Global backshot = LoadAnimImage("Graphics\Backshot.bmp", 16, 16, 0, 4) ;load backshot. Global rockets = LoadAnimImage("Graphics\Rockets.bmp", 16, 16, 0, 16) Global explode = LoadAnimImage("Graphics\Explosion.bmp", 32, 32, 0, 24) Global appear = LoadAnimImage("Graphics\Saucer Appear.bmp", 32, 32, 0, 16) Global boss = LoadImage("Graphics\Boss.bmp") Global asteroid, bset, bossanim, gballs, ahole MaskImage sprites, 255, 0, 255 MaskImage pods, 255, 0, 255 MaskImage rocks, 255, 0, 255 MaskImage bigrocks, 255, 0, 255 MaskImage aliens, 255, 0, 255 MaskImage shots, 255, 0, 255 MaskImage bigshots, 255, 0, 255 MaskImage powerup, 255, 0, 255 MaskImage upgrade, 255, 0, 255 MaskImage backshot, 255, 0, 255 MaskImage rockets, 255, 0, 255 MaskImage boss, 255, 0, 255 MaskImage explode, 255, 0, 255 MaskImage appear, 255, 0, 255 Global bground1 = LoadImage("Level 1\Space.bmp") Global bground2 = LoadImage("Level 1\Planet_1.bmp") Global bground3 = LoadImage("Level 2\Planet_3.bmp") Global bground4 = LoadImage("Level 2\Space_2.bmp") Global bground5 = LoadImage("Level 2\Sun_1.bmp") Global bground6 = LoadImage("Level 3\Planet_6.bmp") ;LOAD FONTS------* Global titlefont = LoadFont("Bauhaus 93", 162, True, False, False) Global font1 = LoadFont ("Verdana", 14, False, False, False) Global font2 = LoadFont ("Arial", 10, False, False, False) Global font3 = LoadFont("Bauhaus 93", 30, True, False, False) ;SET PLAYER STARTING VARIABLES x_pos=500 :y_pos=700 :lives=3 :speed=3 :bombs=3 :warp=1 :max_speed=3 ;level = 2 : wave = 2 Include "Data\Rock Blaster.bb" ;******************************************************************************************************* ;--------------------------------MAIN LOOP-------------------------------------------------------------- While Not KeyHit(1) If state = 0 TITLESCREEN() Else If state = 1 Cls BACKGROUND() PLAYERDIE() SHOWSCORE() MOVESHIP() POWERUPS() SHOOTING() DRAWROCK() PROGRESS() DRAWALIEN() NEWSHOTS() DRAWSHIP() EXPLODES() DRAWWALLS() STATSBAR() Flip Else If state = 2 GAMEOVER() Else If state = 3 HISCORES() EndIf WaitTimer(framerate) Wend ;------------------------------------------------------------------------------------------------------- ;******************************************************************************************************* Function TITLESCREEN() Cls For i = 0 To 20 Color 200-(i*10), 40-i, 40-i Rect 0+i, 0+i, 1024-(i*2), 768-(i*2), 0 Next Color 15, 15, 25 Rect 100, 328, 180, 360, 1 Rect 744, 328, 180, 360, 1 Rect 454, 326+hilite, 110, 40, 1 Color 200, 40, 40 Rect 100, 328, 180, 360, 0 Rect 744, 328, 180, 360, 0 For i = 0 To 3 Color 120+(i*40), 40, 40 Rect 454+i, 326+i+hilite, 110-(i*2), 40-(i*2), 0 Next Color 40, 80, 40 ;TEXT COLOUR SetFont titlefont Text 120, 100, "SPACE BALLS" SetFont font3 Text 120, 330, "POWER UP" Text 764, 330, "CONTROLS" Text 470, 330, "START" Text 464, 370, "ROCKS" Text 458, 410, "CONFIG" Text 476, 450, "INFO" Text 460, 490, "SCORES" Text 476, 530, "QUIT" SetFont font1 For i = 0 To 15 DrawImage powerup, 110, 360+(i*20), i Text 140, 360+(i*20), p_string$(i) Next Text 764, 366, "S = FIRE / SELECT" Text 764, 386, "A = CHARGE SHOT" Text 764, 406, "D = DROP BOMB" Text 764, 426, "W = WARP" Text 764, 446, "R = INCREASE SPEED" Text 764, 466, "F = DECREASE SPEED" Text 764, 506, "LEFT = MOVE LEFT" Text 764, 526, "RIGHT = MOVE RIGHT" Text 764, 546, "UP = MOVE UP" Text 764, 566, "DOWN = MOVE DOWN" Text 764, 606, "SPACE = PAUSE" Text 764, 626, "ESC = QUIT" Text 764, 646, "TAB = ABORT GAME" ;CONTROLS If KeyHit(200) And hilite > 0 ;UP hilite = hilite - 40 Else If KeyHit(208) And hilite <> 200 ;DOWN hilite = hilite + 40 EndIf If KeyHit(31) If hilite = 0 state = 1 FlushKeys Else If hilite = 40 state = 1 level = -1 FlushKeys Else If hilite = 160 state = 3 Else If hilite = 200 End EndIf EndIf Flip End Function ;----------------------------------------------------------------------------------------------------- ;***************************************************************************************************** Function LEVELCLEAR() FlushKeys While Not KeyHit(31) Cls For i = 0 To 20 Color 200-(i*10), 40-i, 40-i Rect 0+i, 0+i, 1024-(i*2), 768-(i*2), 0 Next SetFont titlefont Color 40, 80, 40 Text 120, 100, "LEVEL CLEAR" SetFont font3 Text 360, 330, "GET READY FOR LEVEL "+(level+2) Flip Wend DELETEOBJECTS() level = level +1 wave = 0 :wavecounter = 0 :wavebit =0 End Function ;***************************************************************************************************** ;----------------------------------------------------------------------------------------------------- Function GAMEOVER() FlushKeys ;DETERMINE IF THERE IS A NEW HISCORE If score > hiscore(8) ;If the score is more than the lowest score on highscores newscore = 1 ;There is a new score hiscore(8) = score ;Then the lowest highscore is the players score for now name$(8) = "" ;Delete the old score name ;PUT THE NEW HISCORE IN ITS CORRECT POSITION For i = 0 To 8 ;For each score on hiscores For z = 0 To 8 ;Compare it to each other score If hiscore(z) <= hiscore(i) ;If the second score is lower than the first score swap their positions temp = hiscore(i) temp2$ = name$(i) hiscore(i) = hiscore(z) hiscore(z) = temp name$(i) = name$(z) name$(z) = temp2$ EndIf Next Next For i = 0 To 8 ;Get new scores position on table If hiscore(i) > score Then pos = pos+1 Next If hiscore(i) > high_score Then high_score = hiscore(i) ;If a new hiscore is set then change high_score EndIf While Not KeyHit(31) Cls For i = 0 To 20 Color 200-(i*10), 40-i, 40-i Rect 0+i, 0+i, 1024-(i*2), 768-(i*2), 0 Next SetFont titlefont Color 40, 80, 40 Text 110, 100, "GAME OVER" SetFont font3 Text 440, 380, "HI SCORES" SetFont font1 ;DISPLAY HIGHSCORES For i = 0 To 8 Text 400, 420+(i*20), (i+1)+":" Text 424, 420+(i*20), name(i) Text 520, 420+(i*20), "SCORED:" Text 580, 420+(i*20), hiscore(i) Next If newscore = 1 And name_enter = 0 Text 400, 365, "!!YOU HAVE A NEW HIGH SCORE!!" Else Text 396, 365, "PRESS S TO RETURN TO MAIN MENU" EndIf Flip If newscore = 1 And name_enter = 0 Locate 424, 420+(pos*20) name$(pos)=Input() name_enter = 1 EndIf Wend ;SAVE HISCORES------------------------------------* If name_enter = 1 save_scores = WriteFile("Hi_Scores_Test.dat") For i = 0 To 8 WriteLine(save_scores, name$(i)) WriteLine(save_scores, hiscore(i)) Next EndIf DELETEOBJECTS() ;RESET VARIABLES---------------------------------* state =0: level=0: wave =0 :wavebit = 0 :wavecounter=0 x_pos=500 :y_pos=700 :speed=3 :bombs=3 :gun_1=0 :gun_2=0 :gun_3=0 :gun_4=0 :pod=0: warp=1: max_speed=3 score = 0: name_enter = 0 :boss_start = 0 :lives = 3 boss_start =0: degrees2=0: orbdist=0: drawback=0 oldtime=0: wavetime=0: time_bonus=0: point_bonus=0 End Function ;***************************************************************************************************** ;----------------------------------------------------------------------------------------------------- Function SHOWSCORE() SetFont font2 Color 100, 100, 100 For sc.score = Each score If sc\time > 0 Text sc\x, sc\y, sc\value sc\time = sc\time -1 Else Delete sc.score EndIf Next End Function ;----------------------------------------------------------------------------------------------------- ;***************************************************************************************************** Function DELETEOBJECTS() ;DELETE OBJECTS-----------------------------------* For r.rock = Each rock Delete r.rock Next For s.shot = Each shot Delete s.shot Next For p.powerup = Each powerup Delete p.powerup Next For b.boss = Each boss Delete b.boss Next For o.b_orb = Each b_orb Delete o.b_orb Next For a.alien = Each alien Delete a.alien Next For w.wall = Each wall Delete w.wall Next End Function ;***************************************************************************************************** ;----------------------------------------------------------------------------------------------------- Function BACKGROUND() If level = 0 Then BACKGROUND1() If level = 1 Then BACKGROUND2() If level = 2 Then BACKGROUND3() End Function ;***************************************************************************************************** ;----------------------------------------------------------------------------------------------------- Function STATSBAR() SetFont font1 For i = 0 To 19 Color 160-(i*4), 40, 40 Line 0, i, 1024, i Next If charge > 0 For i = 1 To 18 Color 20, 100-(i*4), 20 Line 660, i, 660+charge, i Next EndIf If jinx > 0 For i = 1 To 18 Color 20, 100-(i*4), 20 Line 924, i, 924+(jinx/3), i Next Else If invincible > 0 If i_set = 1 div = 5 Else div = 2 EndIf For i = 1 To 18 Color 20, 100-(i*4), 20 Line 924, i, 924+(invincible/div), i Next Else i_set = 0 EndIf Color 140, 140, 140 If level > -1 Then Text 4,3, "LEVEL: " +(level+1) Text 86,3,"SCORE: " +score Text 266, 3, "LIVES: " +lives Text 346, 3, "SHOT: " +(gun_1+1) Text 426, 3, "SPEED: " +(speed-2) Text 506, 3, "BOMBS: " +bombs Text 586, 3, "WARP: " +warp Text 668, 3, " CHARGE" If level <> -1 Then Text 746, 3, "HISCORE: "+high_score If jinx = 0 And invincible = 0 Text 932, 3, " NO EFFECTS" Else If jinx > 0 Text 930, 3, " JINXED" Else If invincible > 0 Text 930, 3, " IMMUNE" EndIf For x = 0 To 1 Color 100-(x*40), 100-(x*40), 100-(x*40) Rect 0+x, 0+x, 1024-x, 20-x, 0 Color 60, 60, 60 Line 80+x, 2, 80+x, 19 Line 260+x, 2, 260+x, 19 Line 340+x, 2, 340+x, 19 Line 420+x, 2, 420+x, 19 Line 500+x, 2, 500+x, 19 Line 580+x, 2, 580+x, 19 Line 660+x, 2, 660+x, 19 Line 740+x, 2, 740+x, 19 Line 924+x, 2, 924+x, 19 Next If boss_start = 1 b.boss = First boss For z = 0 To 19 Color 160-(z*4), 40, 40 Line 0 ,748+z, boss_max_hp/10, 748+z Color 20, 100-(z*4), 20 Line 0, 748+z, (b\hp/10), 748+z Next For k = 0 To 1 Color 100-(k*40),100-(k*40),100-(k*40) Rect 0+k, 748+k, (boss_max_hp/10)-k+1, 19-k, 0 Next Color 140, 140, 140 Text 6, 751, "BOSS" EndIf ;-------------------------* ;ROCKBLAST STUFF If level = -1 Color 140, 140, 140 Text 746, 3, "TIME: " +wavetime Text 4,3, "WAVE: " +(wave) If time_bonus > 0 For i = 2 To 18 Color 20, 100-(i*4), 20 Line 82, i,259, i Next Color 140, 140, 140 Text 83, 3, "TIME BONUS + " +point_bonus time_bonus = time_bonus -1 EndIf EndIf ;------------------------* End Function ;***************************************************************************************************** ;----------------------------------------------------------------------------------------------------- Function SHOOTING() ;SHOTS For s.shot = Each shot xm=s\x: ym=s\y: dirm=s\dir: spdm=s\spd MOVEDIR() s\x=xm: s\y=ym ;DRAW SHOTS If s\id=22 DrawImage shots, s\x, s\y, (s\id + (s\timer/4) Mod 4) Else If s\id < 100;NORMAL SHOTS DrawImage shots, s\x, s\y, s\id Else If s\id =116 ;WARP GUN DrawImage bigshots, s\x, s\y, ((s\id-100)+(s\timer/2)) Else If s\id <200 ;BIG SHOTS DrawImage bigshots, s\x, s\y, (s\id-100) Else If s\id =300 ;HOMING MISSILES DrawImage rockets, s\x, s\y, s\dir Else ;BEAM SHOTS Color 35, 25, 130 Rect s\x, s\y, 5, 220, 1 For i = 1 To 10 Color 40+(i*5), 40+(i*5), 140+(i*10) Rect s\x, s\y+(i*20), 5, 20 Next EndIf ;HOMING MISSILES If s\id = 300 If s\timer < 81 And s\timer Mod 10 = 0 If boss_start = 1 b.boss = First boss GETANGLE(s\x+8, s\y+8, b\x+64, b\y+64) Else closest = 100000 For r.rock = Each rock If r\x > 0 And r\x < 992 And r\y > 0 And r\y < 730 GETDISTANCE(s\x+8, s\y+8, r\x+16, r\y+16) If distance < closest closest=distance GETANGLE(s\x+8, s\y+8, r\x+16, r\y+16) EndIf EndIf Next For a.alien = Each alien If a\x > 0 And a\x < 992 And a\y > 0 And a\y < 730 GETDISTANCE(s\x+8, s\y+8, a\x+16, a\y+16) If distance < closest closest=distance GETANGLE(s\x+8, s\y+8, a\x+16, a\y+16) EndIf EndIf Next EndIf ANGLE_TO_DIR() s\dir = direct EndIf EndIf ;GRAVITY SHOTS If s\id > 107 And s\id < 112 For s2.shot = Each shot If s2\shot_by > 0 And s2\id < 100 GETDISTANCE(s\x+16, s\y+16, s2\x, s2\y) If distance < 20 GETANGLE(s\x, s\y, s2\x, s2\y) If angle > 348 And angle < 10 s2\dir = 12 s2\y = s2\y+s2\spd Else If angle < 33 s2\dir =13 s2\y = s2\y+s2\spd s2\x = s2\x-(s2\spd/2) Else If angle < 56 s2\dir = 14 s2\y = s2\y+s2\spd s2\x = s2\x-s2\spd Else If angle < 78 s2\dir = 15 s2\y = s2\y+(s2\spd/2) s2\x = s2\x-s2\spd Else If angle < 100 s2\dir = 0 s2\x = s2\x-s2\spd Else If angle < 123 s2\dir = 1 s2\x = s2\x-s2\spd s2\y = s2\y-(s2\spd/2) Else If angle < 146 s2\dir = 2 s2\x = s2\x-s2\spd s2\y = s2\y-s2\spd Else If angle < 168 s2\dir = 3 s2\x = s2\x-(s2\spd/2) s2\y = s2\y-s2\spd Else If angle < 190 s2\dir = 4 s2\y = s2\y-s2\spd Else If angle < 213 s2\dir = 5 s2\y = s2\y-s2\spd s2\x = s2\x+(s2\spd/2) Else If angle < 235 s2\dir = 6 s2\y = s2\y-s2\spd s2\x = s2\x+s2\spd Else If angle < 257 s2\dir = 7 s2\y = s2\y-(s2\spd/2) s2\x = s2\x+s2\spd Else If angle < 280 s2\dir = 8 s2\x = s2\x+s2\spd Else If angle < 302 s2\dir = 9 s2\x = s2\x+s2\spd s2\y = s2\y+(s2\spd/2) Else If angle < 325 s2\dir = 10 s2\x = s2\x+s2\spd s2\y = s2\y+s2\spd Else s2\dir = 11 s2\x = s2\x+(s2\spd/2) s2\y = s2\y+s2\spd EndIf EndIf EndIf If ImagesCollide(bigshots, s\x, s\y, 0,shots, s2\x, s2\y,0) Delete s2.shot EndIf Next EndIf ;CHECK FOR SHOT COLLISIONS ;VS Rocks For r.rock = Each rock If r\id < 100 If ImagesCollide (shots, s\x, s\y, gun_1, rocks, r\x, r\y, 0) Or ImagesCollide (bigshots, s\x, s\y, 0, rocks, r\x, r\y, 0) Or ImagesCollide(rockets, s\x, s\y, s\dir, rocks, r\x, r\y, 0) If r\been_hit=0 Then r\hp = r\hp - s\dam If s\id = 22 Or s\id = 300 e.explode = New explode e\x=s\x-8: e\y=s\y-8 EndIf If s\id < 104 Or s\id > 116 Delete s.shot Else r\been_hit =1 EndIf shotgone = 1 If r\hp < 1 NEWPOWERUP(r\x, r\y) e.explode = New explode e\x=r\x: e\y=r\y score = score +10 Delete r.rock EndIf Exit EndIf Else If ImagesCollide (shots, s\x, s\y, gun_1, bigrocks, r\x, r\y, 0) Or ImagesCollide (bigshots, s\x, s\y, 0, bigrocks, r\x, r\y, 0) Or ImagesCollide(rockets, s\x, s\y, s\dir, rocks, r\x, r\y, 0) If r\been_hit=0 Then r\hp = r\hp - s\dam If s\id = 22 Or s\id = 300 e.explode = New explode e\x=s\x-8: e\y=s\y-8 EndIf If s\id < 104 Or s\id > 116 Delete s.shot Else r\been_hit =1 EndIf shotgone = 1 If r\hp < 1 For f = 1 To 4 e.explode = New explode e\x=r\x+Rand(1,32): e\y=r\y+Rand(1,32) r2.rock = New rock If f = 1 r2\x=r\x-2: r2\y=r\y-2 r2\dir=Rand(0,4) Else If f = 2 r2\x=r\x+34: r2\y=r\y-2 r2\dir=Rand(4,8) Else If f = 3 r2\x=r\x-2: r2\y=r\y+34 r2\dir=Rand(12,15) Else If f = 4 r2\x=r\x+34: r2\y=r\y+34 r2\dir=Rand(8,12) EndIf r2\spd=Rand(1,4): r2\id=Rand(0,15): r2\hp=12: Next score = score +30 Delete r.rock EndIf Exit EndIf EndIf Next ;VS ALIENS If shotgone = 0 For a.alien = Each alien If s\id <> 200 And s\shot_by < 2 If ImagesCollide (shots, s\x, s\y, gun_1, aliens, a\x, a\y, 0) Or ImagesCollide (bigshots, s\x, s\y, 0, aliens, a\x, a\y, 0) Or ImagesCollide(rockets, s\x, s\y, s\dir, aliens, a\x, a\y, 0) If s\shot_by = 0 And a\been_hit=0 Then a\hp = a\hp - s\dam If s\id = 22 Or s\id =300 e.explode = New explode e\x=s\x-8: e\y=s\y-8 EndIf If s\id < 104 Or s\id > 116 Delete s.shot Else a\been_hit =1 EndIf shotgone =1 If a\hp < 1 NEWPOWERUP(a\x, a\y) e.explode = New explode e\x=a\x: e\y=a\y score = score + a\points Delete a.alien EndIf Exit EndIf EndIf Next EndIf ;VS Player If shotgone = 0 If s\shot_by > 0 If s\id <200 If ImagesCollide (shots, s\x, s\y, 0, sprites, x_pos, y_pos, 0) And invincible = 0 Then player_dead = 1 If gun_2 > 0 If ImagesCollide (shots, s\x, s\y, 0, upgrade, (x_pos-16), (y_pos+8), 1) gun_2=0 Delete s.shot shotgone = 1 EndIf EndIf If gun_3 > 0 And shotgone = 0 If ImagesCollide (shots, s\x, s\y, 0, upgrade, (x_pos+32), (y_pos+8), 1) gun_3=0 Delete s.shot shotgone = 1 EndIf EndIf If gun_4 >0 And shotgone = 0 If ImagesCollide (shots, s\x, s\y, 0, backshot, (x_pos+16), (y_pos+32), 1) Delete s.shot shotgone = 1 gun_4 = 0 Else If ImagesCollide (shots, s\x, s\y, 0, backshot, (x_pos), (y_pos+32), 1) Delete s.shot shotgone = 1 gun_4 = 0 EndIf EndIf Else If ImageRectCollide(sprites, x_pos, y_pos, 0, s\x, s\y, 4, 220) And invincible = 0 Then player_dead =1 If gun_2 > 0 If ImageRectCollide(upgrade, (x_pos-16), (y_pos+8), 1, s\x, s\y, 4, 100) Then gun_2 = 0 EndIf If gun_3 > 0 If ImageRectCollide(upgrade, (x_pos+32), (y_pos+8), 1, s\x, s\y, 4, 100) Then gun_3 = 0 EndIf EndIf If pod > 0 And shotgone = 0 For p.pod = Each pod If ImagesCollide (shots, s\x, s\y, 0, pods, p\x, p\y, 0) p\hp = p\hp-1 Delete s.shot shotgone = 1 If p\hp < 1 Delete p.pod pod = pod - 1 EndIf Exit EndIf Next EndIf EndIf EndIf ;VS Boss If shotgone = 0 If boss_start = 1 For o.b_orb = Each b_orb If level = 0 If ImagesCollide (shots, s\x, s\y, 0, sprites, o\x, o\y, 7) Or ImagesCollide(rockets, s\x, s\y, 0, sprites, o\x, o\y, 0) Delete s.shot shotgone = 1 Exit EndIf Else If level = 2 If ImagesCollide (shots, s\x, s\y, 0, gballs, o\x, o\y, 0) Or ImagesCollide(rockets, s\x, s\y, 0, gballs, o\x, o\y, 0) Delete s.shot shotgone = 1 Exit EndIf EndIf Next If shotgone = 0 If s\shot_by = 0 b.boss = First boss If ImagesCollide (shots, s\x, s\y, 0, boss, b\x, b\y, 0) Or ImagesCollide(rockets, s\x, s\y, 0, boss, b\x, b\y, 0) b\hp = b\hp - s\dam If s\id = 22 Or s\id = 300 e.explode = New explode e\x=s\x-8: e\y=s\y-8 EndIf If b\hp < 1 If b\id = 0 For o.b_orb = Each b_orb e.explode = New explode e\x=o\x: e\y=o\y Next EndIf For i = 1 To 5 e.explode = New explode e\x = (b\x)+Rand(0, boss_width): e\y = (b\y)+Rand(0, boss_height) Next score = score + b\points Delete b.boss boss_start = 0 wave = wave + 1 Else If s\id > 99 e.explode = New explode e\x=s\x: e\y=s\y Delete s.shot shotgone = 1 EndIf If shotgone = 0 Delete s.shot shotgone = 1 EndIf EndIf EndIf EndIf EndIf EndIf If shotgone = 0 s\timer = s\timer - 1 If s\timer < 1 If s\id = 115 e.explode = New explode e\x=s\x: e\y=s\y For g = 0 To 15 bs.shot = New shot If g < 4 Or g > 12 bs\x=s\x Else If g > 4 And g < 12 bs\x=s\x +28 Else bs\x=s\x+14 EndIf If g > 0 And g < 8 bs\y = s\y Else If g > 8 bs\y = s\y+28 Else bs\y = s\y+14 EndIf bs\dir=g: bs\id=0 :bs\dam=1 :bs\spd=3 :bs\timer=1000 :bs\shot_by=1 Next Delete s.shot shotgone=1 Else Delete s.shot shotgone=1 EndIf EndIf EndIf Next End Function ;***************************************************************************************************** ;----------------------------------------------------------------------------------------------------- Function NEWSHOTS() If Not KeyDown(30) ;RELEASE CHARGED SHOT If charged = 1 s.shot = New shot s\dam= (charge *3)/5 s\id = 100+((charge/20)-1) ;FOR LOW GUN If s\id = 99 Then s\id = 100 ;FOR MEDIUM GUN If gun_1 >0 And gun_1 < 3 s\id = s\id + 4 If s\id =103 Then s\id = 104 Else If gun_1 >3 s\id = s\id + 8 If s\id =107 Then s\id = 108 EndIf s\x = x_pos :s\y = y_pos + 14 :s\spd = 7:s\dir = 4 :s\timer =1000 charge = 0 :charged = 0 EndIf charge = 0 EndIf If KeyDown(30) And player_dead = 0 ;CHARGE SHOT If charge < max_charge Then charge = charge + 1 guncount = -20 If charge > 10 Then charged = 1 Else If KeyDown(31) And player_dead = 0 ;NORMAL SHOT guncount = guncount + 1 ;WAVE GUNS If guncount Mod 3 = 0 If gun_2 = 3 s.shot = New shot s\x = x_pos - 10 :s\y = y_pos + 14 :s\spd = 7 :s\dam = 2 :s\dir = gun_2dir :s\timer =20 s\id = s\dir +6 If gun_2dir = 2 s\timer = s\timer - 10 Else If gun_2dir = 1 Or gun_2dir = 3 s\timer = s\timer - 5 EndIf gun_2dir = gun_2dir +1 If gun_2dir > 4 Then gun_2dir = 0 EndIf If gun_3 = 3 s.shot = New shot s\x = x_pos + 34 :s\y = y_pos + 14 :s\spd = 7 :s\dam = 2 :s\dir = gun_3dir :s\timer =20 s\id = 5 s\id = s\dir +6 If gun_3dir = 6 s\timer = s\timer - 10 Else If gun_3dir = 5 Or gun_3dir = 7 s\timer = s\timer - 5 EndIf gun_3dir = gun_3dir -1 If gun_3dir < 4 Then gun_3dir = 8 EndIf EndIf ;WARP CANNONS If guncount > 10 If gun_2 = 4 If Rand(1, 5) = 5 s.shot = New shot s\x=Rand(0, 992) If s\x > x_pos - 64 And s\x < x_pos + 96 Then s\x = s\x-100 s\y=Rand(0, 732) If s\y > y_pos - 64 And s\y < y_pos + 96 Then s\y=s\y-100 s\id = 116 :s\spd=0 s\dam=1 :s\timer=23 :s\shot_by=0 EndIf EndIf If gun_3 = 4 If Rand(1, 5) = 5 s.shot = New shot s\x=Rand(0, 992) If s\x > x_pos - 64 And s\x < x_pos + 96 Then s\x = s\x-100 s\y=Rand(0, 732) If s\y > y_pos - 64 And s\y < y_pos + 96 Then s\y=s\y-100 s\id = 116 :s\spd=0 s\dam=1 :s\timer=23 :s\shot_by=0 EndIf EndIf EndIf ;STANDARD GUNS If guncount > 10 s.shot = New shot s\x = x_pos+5 :s\y = y_pos :s\spd = 7 :s\dam = 2+gun_1 :s\dir = 4 :s\id = gun_1 :s\timer =500:s\shot_by=0 DrawImage shots, (x_pos+5), y_pos, s\id s.shot = New shot s\x = x_pos+19 :s\y = y_pos :s\spd = 7 :s\dam = 2+gun_1 :s\dir = 4 :s\id = gun_1 :s\timer =500:s\shot_by=0 DrawImage shots, (x_pos+19), y_pos, s\id guncount = 0 If gun_2 = 1 s.shot = New shot s\x = x_pos - 12 :s\y = y_pos + 8 :s\spd = 7 :s\dam = 3 :s\dir = 4 :s\timer =500 EndIf If gun_3 = 1 s.shot = New shot s\x = x_pos + 36 :s\y = y_pos + 8 :s\spd = 7 :s\dam = 3 :s\dir = 4 :s\timer =500 EndIf If gun_4 = 1 If backframe < 2 Then offset = 9 s.shot = New shot s\x = x_pos+offset :s\y = y_pos+36 :s\spd = 7 :s\dam = 1 :s\dir =12 :s\timer =500 s.shot = New shot s\x = x_pos+17+offset :s\y = y_pos+36 :s\spd = 7 :s\dam = 1 :s\dir =12 :s\timer =500 EndIf EndIf ;MISSILE LAUNCHERS If gun_2 = 2 Or gun_3 = 2 rocketcount = rocketcount + 1 If rocketcount = 120 If gun_2 = 2 s.shot = New shot s\x = x_pos-12: s\y = y_pos-4: s\spd =7: s\dam=10: s\dir=4 s\id =300: s\timer=100 EndIf If gun_3 = 2 s.shot = New shot s\x = x_pos+36: s\y = y_pos-4: s\spd =7: s\dam=10: s\dir=4 s\id =300: s\timer=100 EndIf rocketcount = 0 EndIf EndIf EndIf End Function ;----------------------------------------------------------------------------------------------------- ;***************************************************************************************************** Function MOVESHIP() If jinx > 0 Then jinx = jinx - 1 If KeyDown(200) ;UP PRESSED If jinx = 0 If y_pos > 0 Then y_pos = y_pos - speed Else If y_pos < 736 Then y_pos = y_pos + speed EndIf Else If KeyDown(208) ;DOWN PRESSED If jinx = 0 If y_pos < 736 Then y_pos = y_pos + speed Else If y_pos > 0 Then y_pos = y_pos - speed EndIf EndIf If KeyDown(203) ;LEFT PRESSED If jinx = 0 If x_pos > 0 Then x_pos = x_pos - speed Else If x_pos < 992 Then x_pos = x_pos + speed EndIf Else If KeyDown(205) ;RIGHT PRESSED If jinx = 0 If x_pos < 992 Then x_pos = x_pos + speed Else If x_pos > 0 Then x_pos = x_pos - speed EndIf EndIf If KeyHit(17) And warp > 0 warp = warp - 1 e.explode = New explode e\x=x_pos: e\y=y_pos :e\frame=23 :e\counter=25 x_pos = Rand(1,992) y_pos = Rand(1,736) e.explode = New explode e\x=x_pos: e\y=y_pos :e\frame=11 EndIf If KeyHit(32) And bombs > 0 s.shot = New shot s\x=x_pos+8: s\y=y_pos+8: s\spd=0: s\dam=70: s\shot_by=0: s\id=22 :s\timer=10000 bombs=bombs-1 EndIf If KeyHit(19) And speed < max_speed Then speed = speed + 1 If KeyHit(33) And speed > 3 Then speed = speed - 1 If KeyHit(57) ;PAUSE FlushKeys WaitKey EndIf If KeyHit(15) Then state = 2 End Function ;***************************************************************************************************** ;------------------------------------------------------------------------------------------------------ Function DRAWROCK() rockcount = 0 For r.rock = Each rock ;DRAW ROCK If r\id < 100 DrawImage rocks, r\x, r\y, r\id Else DrawImage bigrocks, r\x, r\y, (r\id-100) EndIf ;CHECK FOR COLLISION ;Check for collision with screen edge If r\x <= 0 r\dir = Rand(5, 13) Else If r\x >= 992 While r\dir > 3 And r\dir < 13 r\dir = Rand(0, 15) Wend EndIf If r\y <= 0 r\dir = Rand(9, 15) Else If r\y >= 734 r\dir = Rand(1, 7) EndIf ;Check for collisions with other rocks If r\id < 100 ;determine if r.rock is big or small and get centeroid rcx=r\x+16 rcy=r\y+16 Else rcx=r\x+32 rcy=r\y+32 r_big = 1 EndIf For s.rock = Each rock If r <> s If r_big = 1 If s\id > 99 ;determine if s.rock is big If ImagesCollide(bigrocks, r\x, r\y, 0, bigrocks, s\x, s\y, 0) GETANGLE(rcx, rcy, s\x+32, s\y+32) ANGLE_TO_DIR() s\dir = direct: r\dir = direct r\dir = r\dir+8 If r\dir > 15 Then r\dir = r\dir -15 EndIf Else ;s.rock is small If ImagesCollide(bigrocks, r\x, r\y, 0, rocks, s\x, s\y, 0) GETANGLE(rcx, rcy, s\x+16, s\y+16) ANGLE_TO_DIR() s\dir = direct: r\dir = direct r\dir = r\dir+8 If r\dir > 15 Then r\dir = r\dir -15 EndIf EndIf Else If s\id > 99 If ImagesCollide(rocks, r\x, r\y, 0, bigrocks, s\x, s\y, 0) GETANGLE(rcx, rcy, s\x+32, s\y+32) ANGLE_TO_DIR() s\dir = direct: r\dir = direct r\dir = r\dir+8 If r\dir > 15 Then r\dir = r\dir -15 EndIf Else If ImagesCollide (rocks, r\x, r\y, 0, rocks, s\x, s\y, 0) GETANGLE(rcx, rcy, s\x+16, s\y+16) ANGLE_TO_DIR() s\dir = direct: r\dir = direct r\dir = r\dir+8 If r\dir > 15 Then r\dir = r\dir -15 EndIf EndIf EndIf EndIf Next ;Check for collision with player If invincible = 0 If ImagesCollide (rocks, r\x, r\y, 0, sprites, x_pos, y_pos, 0) Then player_dead = 1 EndIf If ImagesCollide (rocks, r\x, r\y, 0, upgrade, (x_pos-16), (y_pos+8), 1) And gun_2 >0 e.explode = New explode e\x=r\x: e\y=r\y Delete r.rock rockgone = 1 gun_2 = 0 Else If ImagesCollide (rocks, r\x, r\y, 0, upgrade, (x_pos+32), (y_pos+8), 1) And gun_3 >0 e.explode = New explode e\x=r\x: e\y=r\y Delete r.rock rockgone = 1 gun_3 = 0 Else If ImagesCollide (rocks, r\x, r\y, 0, backshot, (x_pos+16), (y_pos+32), 1) And gun_4 >0 e.explode = New explode e\x=r\x: e\y=r\y Delete r.rock rockgone = 1 gun_4 = 0 Else If ImagesCollide (rocks, r\x, r\y, 0, backshot, (x_pos), (y_pos+32), 1) And gun_4 >0 e.explode = New explode e\x=r\x: e\y=r\y Delete r.rock rockgone = 1 gun_4 = 0 EndIf If pod > 0 And rockgone = 0 For o.pod = Each pod If r\id > 99 If ImagesCollide (bigrocks, r\x, r\y, 0, pods, o\x, o\y, 0) o\hp = o\hp-1 r\hp = r\hp-1 If r\hp < 1 For f = 1 To 4 e.explode = New explode e\x=r\x+Rand(1,32): e\y=r\y+Rand(1,32) r2.rock = New rock If f = 1 r2\x=r\x-2: r2\y=r\y-2 r2\dir=Rand(0,4) Else If f = 2 r2\x=r\x+34: r2\y=r\y-2 r2\dir=Rand(4,8) Else If f = 3 r2\x=r\x-2: r2\y=r\y+34 r2\dir=Rand(12,15) Else If f = 4 r2\x=r\x+34: r2\y=r\y+34 r2\dir=Rand(8,12) EndIf r2\spd=Rand(1,4): r2\id=Rand(0,15): r2\hp=12: Next score = score +30 Delete r.rock rockgone =1 Else GETANGLE(o\x+8, o\y+8, r\x+32, r\y+32) ANGLE_TO_DIR() r\dir = direct EndIf EndIf Else If ImagesCollide (rocks, r\x, r\y, 0, pods, o\x, o\y, 0) o\hp = o\hp-1 r\hp = r\hp-1 If r\hp < 1 e.explode = New explode e\x=r\x: e\y=r\y Delete r.rock rockgone = 1 If o\hp < 1 Delete o.pod pod = pod - 1 Exit EndIf Exit Else GETANGLE(o\x+8, o\y+8, r\x+16, r\y+16) ANGLE_TO_DIR() r\dir = direct EndIf EndIf EndIf Next EndIf ;Check for boss collision If boss_start = 1 And rockgone = 0 b.boss = First boss If b\id = 0 Or b\id=2 For bo.b_orb = Each b_orb If level = 0 If ImagesCollide (rocks, r\x, r\y, 0, sprites, bo\x, bo\y, 7) GETANGLE(bo\x+16, bo\y+16, r\x+16, r\y+16) ANGLE_TO_DIR() r\dir = direct EndIf Else If level = 2 If ImagesCollide (rocks, r\x, r\y, 0, gballs, bo\x, bo\y, 0) e.explode = New explode e\x=r\x: e\y=r\y Delete r.rock rockgone = 1 Exit EndIf EndIf Next EndIf If rockgone = 0 If ImagesCollide (rocks, r\x, r\y, 0, boss, b\x, b\y, b\id) e.explode = New explode e\x=r\x: e\y=r\y Delete r.rock rockgone = 1 EndIf EndIf EndIf If rockgone = 0 xm=r\x: ym=r\y: dirm=r\dir: spdm=r\spd MOVEDIR() r\x=xm: r\y=ym EndIf rockcount = rockcount +1 If rockgone = 0 If r\been_hit = 1 If world_timer Mod 100 = 0 Then r\been_hit=0 EndIf Next End Function ;***************************************************************************************************** ;_____________________________________________________________________________________________________ Function DRAWALIEN() For a.alien = Each alien xm=a\x: ym=a\y: dirm=a\dir: spdm=a\spd MOVEDIR() a\x=xm: a\y=ym DrawImage(aliens, a\x, a\y, a\id) If a\been_hit = 1 If world_timer Mod 100 = 0 Then a\been_hit=0 EndIf ;PLAYER COLLISIONS If invincible = 0 If ImagesCollide(aliens, a\x, a\y, 0, sprites, x_pos, y_pos, 0) player_dead =1 e.explode = New explode e\x=a\x: e\y=a\y Delete a.alien deleted = 1 EndIf EndIf If deleted = 0 ;ALIEN COLLISIONS If ImagesCollide (aliens, a\x, a\y, a\id, upgrade, (x_pos-16), (y_pos+8), 1) And gun_2 >0 e.explode = New explode e\x=a\x: e\y=a\y Delete a.alien deleted = 1 gun_2 = 0 Else If ImagesCollide (aliens, a\x, a\y, a\id, upgrade, (x_pos+32), (y_pos+8), 1) And gun_3 >0 e.explode = New explode e\x=a\x: e\y=a\y Delete a.alien deleted = 1 gun_3 = 0 Else If ImagesCollide (aliens, a\x, a\y, a\id, backshot, (x_pos+16), (y_pos+32), 1) And gun_4 >0 e.explode = New explode e\x=a\x: e\y=a\y Delete a.alien deleted = 1 gun_4 = 0 Else If ImagesCollide (aliens, a\x, a\y, a\id, backshot, (x_pos), (y_pos+32), 1) And gun_4 >0 e.explode = New explode e\x=a\x: e\y=a\y Delete a.alien deleted = 1 gun_4 = 0 ;IF ALIEN FAR OFF SCREEN THEN DELETE IT Else If a\x > 1200 Or a\x < -200 Or a\y > 900 Or a\y <-200 Delete a.alien deleted = 1 EndIf EndIf If pod > 0 And deleted = 0 For o.pod = Each pod If ImagesCollide (aliens, a\x, a\y, 0, pods, o\x, o\y, (degrees Mod 4)) o\hp = o\hp-1 a\hp = a\hp-1 If a\hp < 1 e.explode = New explode e\x=a\x: e\y=a\y Delete a.alien deleted = 1 If o\hp < 1 Delete o.pod pod = pod - 1 Exit EndIf Exit EndIf EndIf Next EndIf ;ALIEN SHOTS If deleted = 0 If a\id = 1 And route <> 7 And route <> 8 If Rand(1, 300) = 300 s.shot = New shot If a\y < 620 s\y=a\y+30: s\dir=12: Else s\y=a\y-30: s\dir=4: EndIf s\x=a\x+2:s\spd=3: s\id=0 :s\shot_by=1 :s\timer=500 s.shot = New shot If a\y < 620 s\y=a\y+30: s\dir=12: Else s\y=a\y-30: s\dir=4: EndIf s\x = a\x+26: s\spd=3: s\id=0 :s\shot_by=1 :s\timer=500 EndIf Else If a\id=2 a\timer2 = a\timer2 + 1 If a\timer2 > 4999 ;WARMUP SHOT If a\timer2 < 5100 offset = (a\timer2-5000)/20 For i = 1 To offset Color 140-(30*i), 140-(30*i), 255-(40*i) Rect a\x+15-i, a\y+29-i, 1+(i*2), 1+(i*2),0 Next Else s.shot = New shot s\x = a\x+12: s\y =a\y+29: s\dir=12: s\spd=4: s\id=200: s\shot_by=1 :s\timer=500 a\timer2 = 0 EndIf Else If a\timer2 + Rand(0, 300) = 500 Or a\timer2 =1500 a\timer2=5000 EndIf EndIf EndIf ;ALIEN ROUTES If deleted = 0 If a\route = 0 If a\timer = 0 For z.alien =Each alien If a\x <> z\x And a\y <> z\y If ImagesCollide(aliens, a\x, a\y, 2, aliens, z\x, z\y, 0) a\dir = a\dir + 8 If a\dir > 15 Then a\dir = a\dir -16 a\timer = 10 EndIf EndIf Next Else a\timer = a\timer -1 EndIf If a\x > 992 Then a\dir = 0 If a\x < 1 Then a\dir = 8 If a\y > 736 Then a\dir = 4 If a\y < 20 Then a\dir = 12 xm=a\x: ym=a\y :dirm=a\dir :spdm=a\spd MOVEDIR() a\x=xm: a\y=ym ;TRIANGLE FROM TOP Else If a\route = 1 a\timer = a\timer+1 If a\timer = (400/a\spd) a\dir = 8 Else If a\timer = (1200/a\spd) a\dir =2 Else If a\timer = (1500/a\spd) a\dir = 0 Else If a\timer = (1700/a\spd) a\dir = 14 Else If a\timer = (2000/a\spd) a\timer = (400/a\spd)-1 EndIf ;DIAGONAL TO SQUARE FROM TOP Else If a\route = 2 a\timer = a\timer+1 If a\timer = (450/a\spd) a\dir = 12 Else If a\timer = (600/a\spd) a\dir =0 Else If a\timer = (1550/a\spd) a\dir = 4 Else If a\timer = (2100/a\spd) a\dir = 8 Else If a\timer = (3050/a\spd) a\dir =12 Else If a\timer = (3600/a\spd) a\timer = (600/a\spd)-1 EndIf ;SQUARE AROUND SCREEN FROM BOTTOM LEFT Else If a\route = 3 If a\timer = 0 a\dir = 8 If a\x => 990 Then a\timer = 1 Else If a\timer = 1 a\dir = 4 If a\y <= 24 Then a\timer = 2 Else If a\timer = 2 a\dir = 0 If a\x <= 4 Then a\timer = 3 Else If a\timer = 3 a\dir = 12 If a\y >= 730 Then a\timer = 0 EndIf ;MINE LAYER Else If a\route = 4 If a\x <= 0 a\dir = Rand(5, 13) Else If a\x >= 992 While a\dir > 3 And a\dir < 13 a\dir = Rand(0, 15) Wend EndIf If a\y <= 0 a\dir = Rand(9, 15) Else If a\y >= 734 a\dir = Rand(1, 7) EndIf xm=a\x: ym=a\y :dirm=a\dir :spdm=a\spd MOVEDIR() a\x=xm: a\y=ym If a\timer = 0 For z.alien =Each alien If a\x <> z\x And a\y <> z\y If ImagesCollide(aliens, a\x, a\y, 2, aliens, z\x, z\y, 0) a\dir = a\dir + 8 If a\dir > 15 Then a\dir = a\dir -16 a\timer = 10 EndIf EndIf Next Else a\timer = a\timer -1 EndIf a\timer2 = a\timer2+1 If a\timer2 = 200+Rand(1,100) Or a\timer2=600 s.shot = New shot s\x = (a\x+16): s\y=(a\y+16): s\spd=0 :s\timer=2500 :s\shot_by=2 :s\id=5 a\timer2 = 0 EndIf ;FLY DOWN 1 Else If a\route = 5 a\timer = a\timer +1 If a\timer = 100 Then a\dir = 14 If a\timer = 150 Then a\dir = 10 If a\timer = 200 Then a\dir = 8 ;FLY AROUND Else If a\route = 6 If a\timer > 0 Then a\timer = a\timer-1 a\id = 16+a\dir If a\timer = 0 If a\x < 50 If a\dir < 5 a\dir = a\dir +1 If a\dir=16 Then a\dir = 0 a\timer=3 Else a\dir = a\dir -1 If a\dir=-1Then a\dir=15 a\timer=3 EndIf Else If a\x > 974 If a\dir < 8 a\dir = a\dir-1 If a\dir=-1Then a\dir=15 a\timer=3 Else a\dir = a\dir +1 If a\dir=16 Then a\dir = 0 a\timer=3 EndIf Else If a\y < 50 If a\dir < 4 a\dir = a\dir -1 If a\dir=-1Then a\dir=15 a\timer=3 Else a\dir = a\dir +1 If a\dir=16 Then a\dir = 0 a\timer=3 EndIf Else If a\y > 690 If a\dir > 12 And a\dir < 10 a\dir = a\dir +1 If a\dir=16 Then a\dir = 0 a\timer=3 Else a\dir = a\dir -1 If a\dir=-1Then a\dir=15 a\timer=3 EndIf Else If Rand(300) = 1 a\dir = a\dir +1 If a\dir=16 Then a\dir = 0 Else If Rand(300) = 500 a\dir = a\dir -1 If a\dir=-1Then a\dir=15 Else For a2.alien = Each alien If a2\x <> a\x And a2\y <> a\y If ImagesCollide(aliens, a\x, a\y, 0, aliens, a2\x, a2\y, 0) a\dir = a\dir +1 If a\dir=16 Then a\dir = 0 a\timer =2 EndIf EndIf Next For r.rock = Each rock If ImagesCollide(aliens, a\x, a\y, 0, rocks, r\x, r\y, 0) a\dir = a\dir +8 If a\dir>15 Then a\dir = a\dir-15 EndIf Next EndIf EndIf If Rand(100)=100 s.shot = New shot s\x=a\x+14: s\y=a\y+14: s\dir=a\dir: s\spd=a\spd+3: s\shot_by=2 :s\timer=500 EndIf ;ARRAY DOWN 1 Else If a\route = 7 If a\y < 200 a\dir = 12 Else If a\y < 250 a\dir = 13 Else If a\y < 350 a\dir = 14 Else If a\y < 400 a\dir = 13 Else If a\y < 500 a\dir = 12 Else If a\y < 550 a\dir = 11 Else If a\y < 650 a\dir = 10 Else a\dir = 12 EndIf ;ARRAY DOWN 2 Else If a\route = 8 If a\y < 200 a\dir = 12 Else If a\y < 250 a\dir = 11 Else If a\y < 350 a\dir = 10 Else If a\y < 400 a\dir = 11 Else If a\y < 500 a\dir = 12 Else If a\y < 550 a\dir = 13 Else If a\y < 650 a\dir = 12 Else a\dir = 12 EndIf EndIf EndIf Next End Function ;----------------------------------------------------------------------------------------------------- ;***************************************************************************************************** Function PROGRESS() If level = 0 LEVEL1() Else If level = 1 LEVEL2() Else If level =2 LEVEL3() Else If level = -1 ROCKBLAST() EndIf End Function ;***************************************************************************************************** ;----------------------------------------------------------------------------------------------------- Function PLAYERDIE() If player_dead = 1 If dead_count = 0 e.explode = New explode e\x = x_pos: e\y = y_pos lives = lives - 1 Else If dead_count = 50 x_pos=500 :y_pos=700 :speed=3 :bombs=3 :gun_1=0 :gun_2=0 :gun_3=0 :gun_4=0 :pod=0: warp=1: max_speed=3 player_dead = 0 If lives = 0 Then state = 2 EndIf dead_count = dead_count + 1 If dead_count = 51 dead_count = 0 invincible = 200 EndIf jinx = 0 EndIf End Function ;***************************************************************************************************** Function NEWPOWERUP(x, y) power = Rand (1, 4) If power = 4 ;CREATE NEW POWERUP p.powerup = New powerup p\x = x +8 p\y = y +8 p\timer = 800 SeedRnd MilliSecs() gen = Rand(1, 70) ;DETERMINE POWERUP TYPE If gen = 1 ;EXTRA LIFE p\id =13 Else If gen < 16 ;POINTS p\id =1 Else If gen < 19 ;SIDE CANNON p\id =2 Else If gen < 22 ;HOMING p\id =3 Else If gen < 25 ;SIDE WAVE p\id =4 Else If gen < 28 ;TREASURE POD p\id = 5 Else If gen < 36 ;FIREPOWER p\id = 7 Else If gen < 44 ;SPEED p\id = 0 Else If gen < 48 ;JINX p\id = 12 Else If gen < 52 ;IMMUNE p\id = 11 Else If gen < 56 ;BOMB PACK p\id = 14 Else If gen < 60 ;MEGA BOMB p\id = 10 Else If gen < 66 ;FORCE POD p\id = 6 Else If gen < 69 ;REAR SHOT p\id = 8 Else If gen < 71 ;WARP p\id = 15 EndIf EndIf End Function ;***************************************************************************************************** ;----------------------------------------------------------------------------------------------------- Function POWERUPS() For p.powerup = Each powerup p\timer = p\timer - 1 DrawImage powerup, p\x, p\y, p\id If ImagesCollide (sprites, x_pos, y_pos, 0,powerup, p\x, p\y, p\id) ;SPEED UP If p\id = 0 And speed < 6 speed = speed +1 max_speed = max_speed +1 Else If p\id = 0 And speed = 6 score = score + 50 sc.score = New score sc\x = p\x+2 :sc\y = p\y :sc\time = 100 :sc\value = 50 ;FIREPOWER Else If p\id = 7 If gun_1 < 4 gun_1 = gun_1 + 1 Else score = score + 100 sc.score = New score sc\x = p\x :sc\y = p\y :sc\time = 100 :sc\value = 100 EndIf ;SIDE CANNON Else If p\id = 2 If gun_2 = 1 And gun_3 = 1 score = score + 100 sc.score = New score sc\x = p\x :sc\y = p\y :sc\time = 100 :sc\value = 100 Else If gun_3 = 1 gun_2 = 1 Else If gun_2 = 1 gun_3 = 1 Else If gun_2 = 0 And gun_3 = 0 lr = Rand (0,1) If lr = 0 Then gun_2 =1 If lr = 1 Then gun_3 =1 Else If gun_2 > 0 And gun_3 = 0 gun_3 =1 Else If gun_3 > 0 And gun_2 = 0 gun_2 =1 Else lr = Rand (0,1) If lr = 0 Then gun_2 =1 If lr = 1 Then gun_3 =1 EndIf EndIf ;HOMING MISSILES Else If p\id = 3 If gun_2 = 2 And gun_3 = 2 score = score + 100 sc.score = New score sc\x = p\x :sc\y = p\y :sc\time = 100 :sc\value = 100 Else If gun_3 = 2 gun_2 = 2 Else If gun_2 = 2 gun_3 = 2 Else If gun_2 = 0 And gun_3 = 0 lr = Rand (0,1) If lr = 0 Then gun_2 =2 If lr = 1 Then gun_3 =2 Else If gun_2 > 0 And gun_3 = 0 gun_3 =2 Else If gun_3 > 0 And gun_2 = 0 gun_2 =2 Else lr = Rand (0,1) If lr = 0 Then gun_2 =2 If lr = 1 Then gun_3 =2 EndIf EndIf ;BACK SHOT Else If p\id = 8 If gun_4 = 1 score = score + 100 sc.score = New score sc\x = p\x :sc\y = p\y :sc\time = 100 :sc\value = 100 EndIf gun_4 = 1 ;FORCE POD Else If p\id = 6 If pod = 2 score = score + 100 sc.score = New score sc\x = p\x :sc\y = p\y :sc\time = 100 :sc\value = 100 Else o.pod = New pod o\x = x_pos+8: o\y = ypos+58: o\hp = 100 pod = pod + 1 EndIf ;POINT BONUS Else If p\id = 1 bonus = (Rand(5, 30)*10) score = score + bonus sc.score = New score sc\x = p\x: sc\y = p\y :sc\time = 100 :sc\value = bonus ;WARP Else If p\id = 15 warp = warp + 1 ;BOMB PACK Else If p\id = 14 bombs = bombs + 3 If bombs > 12 Then bombs = 12 ;EXTRA LIFE Else If p\id = 13 lives = lives + 1 ;SIDE WAVE Else If p\id = 4 If gun_2 = 3 And gun_3 = 3 score = score + 100 sc.score = New score sc\x = p\x :sc\y = p\y :sc\time = 100 :sc\value = 100 Else If gun_3 = 3 gun_2 = 3 If gun_3dir = 4 Then gun_2dir = 4 If gun_3dir = 5 Then gun_2dir = 3 If gun_3dir = 6 Then gun_2dir = 2 If gun_3dir = 7 Then gun_2dir = 1 If gun_3dir = 8 Then gun_2dir = 0 Else If gun_2 = 3 gun_3 = 3 gun_3dir = 8 - gun_2dir Else If gun_2 = 0 And gun_3 = 0 lr = Rand (0,1) If lr = 0 Then gun_2 =3 If lr = 1 gun_3 =3 gun_3dir =8 EndIf Else If gun_2 > 0 And gun_3 = 0 gun_3 =3 gun_3dir =8 Else If gun_3 > 0 And gun_2 = 0 gun_2 =3 Else lr = Rand (0,1) If lr = 0 Then gun_2 =3 If lr = 1 gun_3 =3 gun_3dir =8 EndIf EndIf EndIf ;TREASURE POD Else If p\id = 5 If gun_2 = 4 And gun_3 = 4 score = score + 300 sc.score = New score sc\x = p\x :sc\y = p\y :sc\time = 100 :sc\value = 300 Else If gun_3 = 4 gun_2 = 4 Else If gun_2 = 4 gun_3 = 4 Else If gun_2 = 0 And gun_3 = 0 lr = Rand (0,1) If lr = 0 Then gun_2 =4 If lr = 1 Then gun_3 =4 Else If gun_2 > 0 And gun_3 = 0 gun_3 =4 Else If gun_3 > 0 And gun_2 = 0 gun_2 =4 Else lr = Rand (0,1) If lr = 0 Then gun_2 =4 If lr = 1 Then gun_3 =4 EndIf EndIf ;INVULNERABILITY Else If p\id = 11 invincible = 500 i_set = 1 ;JINX Else If p\id = 12 jinx = 300 ;MEGA BOMB Else If p\id = 10 For r.rock = Each rock blasta = Rand(0, 10) r\hp = r\hp - blasta If r\hp < 1 e.explode = New explode e\x=r\x: e\y=r\y score = score +10 Delete r.rock EndIf Next For a.alien = Each alien blasta = Rand(0, 15) a\hp = a\hp - blasta If a\hp < 1 e.explode = New explode e\x=a\x: e\y=a\y score = score + a\points Delete a.alien EndIf Next EndIf Delete p.powerup deleted = 1 EndIf If deleted = 0 If p\timer = 0 Then Delete p.powerup EndIf Next End Function ;----------------------------------------------------------------------------------------------------- ;***************************************************************************************************** Function DRAWSHIP() If player_dead = 0 If invincible = 0 DrawImage sprites, x_pos, y_pos, 0 Else DrawImage sprites, x_pos, y_pos, 1 EndIf If gun_2 >0 And gun_2 <3 DrawImage upgrade, (x_pos -16), (y_pos+8), gun_2 Else If gun_2 = 3 DrawImage upgrade, (x_pos -16), (y_pos+8), 4 Else If gun_2 = 4 DrawImage upgrade, (x_pos -16), (y_pos+8), 5 EndIf If gun_3 >0 And gun_3 < 3 DrawImage upgrade, (x_pos +32), (y_pos+8), gun_3 Else If gun_3 = 3 DrawImage upgrade, (x_pos +32), (y_pos+8), 3 Else If gun_3 = 4 DrawImage upgrade, (x_pos +32), (y_pos+8), 5 EndIf If gun_4 >0 And KeyDown (31) backcount = backcount + 1 If backcount = 10 backframe = backframe + 1 If backframe = 4 Then backframe = 0 backcount = 0 EndIf DrawImage backshot, (x_pos), (y_pos+32), backframe ;Draw rear gun DrawImage backshot, (x_pos+16), (y_pos+32), backframe;Draw rear gun Else If gun_4 > 0 DrawImage backshot, (x_pos), (y_pos+32), 0 DrawImage backshot, (x_pos+16), (y_pos+32), 0 EndIf If pod > 0 degrees = degrees + 3 If degrees > 350 Then degrees = 0 y=Sin(degrees)*60 y=-y x=Cos(degrees)*60 o.pod = First pod o\x = x_pos+8+x :o\y = y_pos+8+y DrawImage pods, o\x, o\y, (degrees Mod 4) If pod = 2 y=Sin(degrees+175)*60 If y > 350 Then y = y -350 y=-y x=Cos(degrees+175)*60 If x > 350 Then x = x -350 o = After o o\x = x_pos+8+x :o\y = y_pos+8+y DrawImage pods, o\x, o\y, (degrees Mod 4) EndIf EndIf EndIf If invincible > 0 Then invincible = invincible -1 world_timer=world_timer+1 If world_timer = 1000000 Then world_timer=0 End Function ;----------------------------------------------------------------------------------------------------- ;***************************************************************************************************** Function EXPLODES() For e.explode = Each explode If e\counter < 25 DrawImage explode, e\x, e\y, e\frame If e\counter Mod 2 = 0 Then e\frame = e\frame + 1 e\counter = e\counter + 1 If e\counter = 23 Then Delete e.explode Else DrawImage explode, e\x, e\y, e\frame If e\counter Mod 2 = 0 Then e\frame = e\frame - 1 e\counter = e\counter + 1 If e\counter = 49 Then Delete e.explode EndIf Next End Function ;***************************************************************************************************** ;----------------------------------------------------------------------------------------------------- Function HISCORES() FlushKeys Cls For i = 0 To 20 Color 200-(i*10), 40-i, 40-i Rect 0+i, 0+i, 1024-(i*2), 768-(i*2), 0 Next SetFont titlefont Color 60, 100, 50 Text 160, 100, "HI SCORES" SetFont font3 Text 260, 340, "HIT ANY KEY TO RETURN TO MAIN MENU" SetFont font1 ;DISPLAY HIGHSCORES For i = 0 To 8 Text 400, 400+(i*20), (i+1)+":" Text 424, 400+(i*20), name(i) Text 520, 400+(i*20), "SCORED:" Text 580, 400+(i*20), hiscore(i) Next Flip WaitKey state = 0 FlushKeys End Function ;----------------------------------------------------------------------------------------------------- ;***************************************************************************************************** ;-----------------------------MOVE OBJECTS ACCORDING THEIR DIRECTION---------------------------------- ;0=left, 1=halfup/left, 2=up/left, 3=up/halfleft, 4=up, 5=up/halfright, 6=up/right, 7=halfup/right ;8=right, 9=halfdown/right, 10=down/right, 11=down/halfright, 12=down, 13=down/halfleft, 14=down/left ;15=halfdown/left. Function MOVEDIR() If dirm = 0 xm = xm - spdm Else If dirm = 1 xm = xm - spdm ym = ym - (spdm /2) Else If dirm = 2 xm = xm - spdm ym = ym - spdm Else If dirm = 3 xm = xm - (spdm/2) ym = ym - spdm Else If dirm = 4 ym = ym - spdm Else If dirm = 5 xm = xm + (spdm/2) ym = ym - spdm Else If dirm = 6 xm = xm + spdm ym = ym - spdm Else If dirm = 7 xm = xm + spdm ym = ym - (spdm/2) Else If dirm = 8 xm = xm + spdm Else If dirm = 9 xm = xm + spdm ym = ym + (spdm/2) Else If dirm = 10 xm = xm + spdm ym = ym + spdm Else If dirm = 11 xm = xm + (spdm/2) ym = ym + spdm Else If dirm = 12 ym = ym + spdm Else If dirm = 13 xm = xm - (spdm/2) ym = ym + spdm Else If dirm = 14 xm = xm - spdm ym = ym + spdm Else If dirm = 15 xm = xm - spdm ym = ym + (spdm/2) EndIf End Function ;----------------------------------------------------------------------------------------------------- ;***************************************************************************************************** Function GETDISTANCE(x_1, y_1,x_2, y_2) ;GET 2 OBJECTS DISTANCE FROM ONE ANOTHER If x_1 < x_2 If x_1 < y_2 distance = Sqr(((x_2 - x_1)*(x_2 - x_1)) + ((y_2 - y_1)*(y_2 - y_1))) Else distance = Sqr(((x_2 - x_1)*(x_2 - x_1)) + ((y_1 - y_2)*(y_1 - y_2))) EndIf Else If y_1 < y_2 distance = Sqr(((x_1 - x_2)*(x_1 - x_2)) + ((y_2 - y_1)*(y_2 - y_1))) Else distance = Sqr(((x_1 - x_2)*(x_1 - x_2)) + ((y_1 - y_2)*(y_1 - y_2))) EndIf EndIf distance = Abs(distance) End Function ;----------------------------------------------------------------------------------------------------- ;***************************************************************************************************** Function GETANGLE(x_1, y_1, x_2, y_2) If x_2 > x_1 x_dist = x_2 - x_1 Else x_dist = x_1 - x_2 EndIf If y_2 > y_1 y_dist = y_2 - y_1 Else y_dist = y_1 - y_2 EndIf radius# = Sqr((x_dist*x_dist)+(y_dist*y_dist)) If y_2 <= y_1 If x_2 <= x_1 angle# = ASin(y_dist/radius#)+270 Else If x_1 < x_2 angle# = ACos(y_dist/radius#) EndIf Else If x_2 <= x_1 angle# = ACos(y_dist/radius#)+180 Else If x_1 < x_2 angle# = ASin(y_dist/radius#)+90 EndIf EndIf End Function ;***************************************************************************************************** ;----------------------------------------------------------------------------------------------------- Function ANGLE_TO_DIR() If angle > 348 And angle < 10 direct = 4 Else If angle < 33 direct =5 Else If angle < 56 direct = 6 Else If angle < 78 direct = 7 Else If angle < 100 direct = 8 Else If angle < 123 direct = 9 Else If angle < 146 direct = 10 Else If angle < 168 direct = 11 Else If angle < 190 direct = 12 Else If angle < 213 direct = 13 Else If angle < 235 direct = 14 Else If angle < 257 direct = 15 Else If angle < 280 direct = 0 Else If angle < 302 direct = 1 Else If angle < 325 direct = 2 Else direct = 3 EndIf End Function ;***************************************************************************************************** ;----------------------------------------------------------------------------------------------------- Function DRAWWALLS() For w.wall = Each wall If level = 2 And wave = 3 DrawImage (asteroid, w\x, w\y) If ImagesCollide(asteroid, w\x, w\y, 0,sprites, x_pos, y_pos,0) And invincible=0 Then player_dead=1 EndIf Next End Function[/code]

|edit| As a matter of fact I am not trying to diss any of these authors or their code, I just don't see the need for fitting everything into one file. Maybe it's because of the general horrible standard on most of the 'IDE's that have been released with any given version of Blitz. I mean, up until BlitzMax, they didn't even support project files, and the Blitzmax 'IDE' didn't even manage to do that properly! |edit|

-----
Afr0 Games

Project Dollhouse on Github - Please fork!
Homepage : http://www.afr0games.com
Posted : Monday, 15 October 2007, 04:40 | Permalink | Mark Here
mike_g


WW Entries : 6
oh, ooh, this one's by you, mike_g! (Not to diss the quality of the final product or anything, which actually turned out very nice)

Well I coded it as a load of separate files, then merged them into one before creating the exe so that the final game didn't need all the include files. Thats an annoying thing about Blitz executables.
Posted : Monday, 15 October 2007, 04:53 | Permalink | Mark Here
Jayenkai


WW Entries : 103
Who would bother to cut out small functions and include stuff when you're only coding that tiny amount?
Really, That's minuscule coding in the grand scheme of things.
If you want a really good example of coding that really should be split into lots of includes, but never really was..

Green's 8-bit Tiny Collection.

7751 lines
164780 characters.
28 functions
One BB file!
And a Whole Lot of Labels!


-----
"Load, Next List!"
Homepage : http://AGameAWeek.com
Posted : Monday, 15 October 2007, 10:15 | Permalink | Mark Here
rockford


Cheers Afro :S

I said I have little experience in C++, I didn't say I had NONE. I certainly have the dedication and motivation to create games, seeing as I have completed over 50 in various languages throughout my coding history (since 1984) - both remakes and original games - under my real name Ian Price and rockford.

I know a BASIC language is nothing like C or C++. How 'king stupid do you take me for? I don't want to drive a jet plane, only create a game for the DS and someone has to start somewhere - if everyone listened to your "expert" opinion nobody would ever strive to achieve anything.

The basics of all lanugages are pretty similar, so I don't expect it to be totally alien (I don't expect an easy ride either, but I'm prepared), but come on guy!

I was asking if anyone wanted to give assistance, a partner that was in a similar position - I wasn't and won't ask you. A wonderful welcome, I'm sure....

Spinal stated "It would be good to work with others who are just starting out on the DS so I don't feel so stupid asking those simple questions." I thought I would reply, to that directly - not expecting a shit response like yours afro. So I'm a noob at coding for the DS. Big deal. We all have to start somewhere.

Cheers to everyone else for the info though
Posted : Monday, 15 October 2007, 13:30 | Permalink | Mark Here
Afr0


WW Entries : 3
I don't want to drive a jet plane, only create a game for the DS and someone has to start somewhere - if everyone listened to your "expert" opinion nobody would ever strive to achieve anything.


It seems you're making it out to look as though I think I'm some sort of expert on C/C++, and well above everyone else. Well, I'm not.
I tried going from BASIC languages to C++ myself, and I only ever got as far as to C#. In my analogy, that's like flying a two-seater Cessna. A step up from driving a taxi, but still nothing like 'the real thing'. I just thought I'd give you a heads up, is all.

-----
Afr0 Games

Project Dollhouse on Github - Please fork!
Homepage : http://www.afr0games.com
Posted : Monday, 15 October 2007, 15:33 | Permalink | Mark Here
Jayenkai


WW Entries : 103
OK, I've added a small Jumpstart tutorial, here, if anyone would like to attempt the most basic of DS coding
It should get your set up, ready for following all the tutorials and things, but without having to read through pages of "C is a language. We write things in languages. For is a loop!" crap.

If anyone has any issues getting started, let me know!

Oh, and one last thing. If you already have a C devkit set up on your system. .. Beware that occasionally C's can clash and break each other!

-----
"Load, Next List!"
Homepage : http://AGameAWeek.com
Latest Posts
Jay's New Lumia 1020
Jayenkai Wed 16:13
Free SIMS 2
Jayenkai Wed 15:13
Good TV?
Jayenkai Wed 02:45
SAT:AM Loving
rockford Tue 08:18
AGameAWeek Progress Report
rychan Mon 23:57
[OUYA] AquaVenture
Jayenkai Mon 07:57
Happy Birthday to All
Jayenkai Mon 02:15
Mog's Village
Mog Sun 19:20
Faceless Piles of Shite
Dabz Thu 18:34
Dabz Takes Manhattan
Jayenkai Thu 18:32
More

Latest Items
Techy : Back from Game Dev Con!
Jayenkai Sun 15:52
Family : Sunday
Jayenkai Wed 02:31
Family : Good News (for once)
Kuron Tue 14:37
Showcase : Don't Tap The Zombies
therevillsgames Mon 15:26
Showcase : Mutant Monty
steve_ancell Wed 18:26
Blog : Update
Kuron Mon 12:52
Techy : New Laptop!?
Kuron Fri 14:52
Showcase : Ascension 2 Live Wallpaper
CodersRule Fri 12:48
Showcase : Saviors of Gundthor
CodersRule Fri 11:50
Showcase : Lava Monkey
rychan Tue 15:13
Blog : Mac Rant!
rockford Fri 13:48
Dev-Diary : Yup, another song
Kuron Wed 05:39
Pets : Old pic to share...
rockford Sat 16:01
Blog : EmuMenu
spinal Sat 10:07
Family : More bad news :c(
Kuron Mon 06:07
More

Who's Online
Jayenkai
Thu, at 10:44
blanko1324
Thu, at 09:34
Krakatomato
Thu, at 09:29
rockford
Thu, at 09:23
HoboBen
Thu, at 08:34
rychan
Thu, at 08:06
steve_ancell
Thu, at 04:10
spinal
Wed, at 23:08
dna
Wed, at 20:37
Evil Roy Ferguson
Wed, at 19:13
Link to this page
Site : Jayenkai 2006-Infinity | MudChat's origins, BBCode's former life, Image Scaler.