The Platform Horde Arcade Game | Experiment

Started by suicidal pencil, Wed 19/08/2009 02:49:59

Previous topic - Next topic

suicidal pencil

Genre: Platform, Arcade
Current Version: 0.81-Alpha
Last Update: October 18, 2009 @ 24:05 EST
latest release: 0.81-alpha
next release: 0.85-alpha
0.81 Release: http://www.mediafire.com/download.php?mwnzamztmdh
0.81 Source: http://www.mediafire.com/download.php?im2inmgxnzz

Game Info and Development

I'm making this just to twist the arms of the AGS engine. I'm an awful graphic artist, but my main focus is on the programming. This is going to be a future project, which will be a collection of AGS arcade games. Anyone who'd like to help are welcome, but no sweat  ;). I put up the source so that people can critique.

Controls: No mouse other than to control the music gui, but you use the left and right arrow keys to move, and the space bar to shoot

To Do List:

  • Create and Script Enemies 100%
  • Finish main character (cleaning up sprites)
  • Finish the music player 110%
  • Find more music (4 songs so far)
  • Optimize code (on-going)
  • Write Documentation 0%
  • Create and Script Enemy deaths and kills 100%
  • Create and Script power-ups 0%
  • Create background 0%
Development Notes

  • August 14, 12:33 EST, update: 14:00:
    Quote from: suicidalpencil]It looks like in order to have an animated enemy, I need to have a character defined for every one. Doing so will make the game too big, so I'm splitting the enemies into two classes: weak and strong. The strong enemies are the ones that will animate, but because there will never be more than 4 strong enemies on screen at a time, I can reduce the amount of characters needed! The weak enemies are going to be dynamic sprites, but that gives me the problems associated with memory management. There's a potential memory leak, if I do not release the memory of the sprites that get 'killed'. This is because dynamic sprites are not handled by the default AGS sprite cache.
    Quote from: AGS 3.1.2 Documentation[create(dynamic sprite)] loads an extra sprite into memory which is not controlled by the normal AGS sprite cache and will not be automatically disposed of. Therefore, when you are finished with the image you MUST call Delete on it to free its memory.
    Found another way to do what I need. Characters are not the only things that can animate. Objects can, too, which I completely forgot about. That makes it so much easier, but it means that I'm going to have about 30 objects in a room -suicidal pencil
  • August 17, 12:42 EST: I finished the enemies. They work like a charm. Now, the player needs to be able to kill them. I'm about 3/4s the way there with it. I'm using object 39 (the 40th object, but the array starts at 0) as a "bullet", where it will move across the screen. Using a short collision detection function, when the bullet collides with an object, it will know the object number of the object, and reduce it's "health", which is just an array, with each element corresponding to an object. So far, it's got bugs up the wahoo, but I'm slowly getting to work right - suicidal pencil
  • August 18, 20:49 EST: Hey, I finally finished scripting the enemies, and the collision! It was a pain; I kept finding new exploits and bugs and different situations where the game would crash. They were mostly me forgetting about the small, insignificant details. A few actually required a few more conditionals ('if', 'else if', 'else' statements). An example being that, when the player taps either of the movement arrows, they could hold the fire button, and kill enemies almost instantly while not using any ammo. (Don't try it, I fixed it). I'd appreciate people telling me of bugs, hangs, exploits, and crashes that occur. - suicidal pencil
  • September 8, 02:34 EST: After a brief hiatus in development, I'm back to working on this. I finished one of the many enemy death sequences and attack sequences, all that remains is to script them in. After the coding is done, adding more sequences will take about ten minutes (just creating the images and putting them in views), and not the hour or so I expect to take scripting the code to run the animation without stopping pausing the game. Having said that, there is not that much more code to write, and I eventually plan to turn my music player into a module for AGS. - suicidal pencil
  • September 30, 15:41 EST: I've finally finished scripting the enemy death sequences. Drawing and animating was not the hard part: Coding it to work properly was. There was a situation where the player could increase the # of frags by holding the space bar and shoot a dieing enemy. Fixed it, but now I have to finish the final player function (death). - suicidal pencil
  • October 15, 21:42 EST: Finally fixed a problem with the right-side enemies stopping walking when they should keep going, and I finally made it so that the player can finally die! Next comes the background, fixing the sprites, and creating the power-ups. - suicidal pencil
  • October 18, 2009 @ 24:05 EST: Released 0.81. Created and fixed some bugs, increased the frequency that the enemies spawned from, and added an instruction display. - suicidal pencil
Here's a quick image of the main character



A screenshot of the latest release (0.71)



as you can probably see, I still have lots of work to do. The obvious ones are the background and player sprites. (I just noticed this, but if you look closely, you can see how I figured out how to "kill" the enemies"
parts of the code

the fully complete music player. You can now add your own music. To add your own music, just copy a song into the music folder, rename it as "Musicx", where x is the next number in the series (so the first song you add would be "4", the second "5", and so on). It is important to make sure that there are no breaks in the series, or the algorithm to find all the music will not work. Then, just compile it in AGS, and run!
Code: ags

enum Music_Gui
{
  Play, 
  Pause, 
  Back, 
  Skip, 
  Next
};

.
.
.

int music_number = 1 + random(music_amount());
int MPOS = 0;
int max_music_number;

.
.
.

function music_amount()
{
  int music_counter = 1;
  while(1)
  {
    PlayMusic(music_counter);
    if(!IsMusicPlaying()) 
    {
      max_music_number = music_counter;
      return music_counter;
    }
    StopMusic();
    music_counter++;
  }
}

.
.
.

function MUSIC (Music_Gui button)
{
  if(button == Next)
  {
    //when the music runs out, this function is called
    if(music_number == max_music_number)
    {
      music_number = 1;
      PlayMusic(music_number);
    }
    else
    {
      music_number++;
      PlayMusic(music_number);
    }
  }
  else if(button == Back)
  {
    //Back
    StopMusic();
    if(music_number == 1)
    {
      music_number = max_music_number;
      PlayMusic(music_number);
    }
    else
    {
      music_number--;
      PlayMusic(music_number);
    }
  }
  else if(button == Play)
  {
    //Play
    if(!IsMusicPlaying())
    {
      PlayMusic(music_number);
      SeekMIDIPosition(MPOS);
      temp_lock1 = false;
    }
  }
  else if(button == Pause)
  {
    //Pause
    if(IsMusicPlaying())
    {
      MPOS = GetMIDIPosition();
      StopMusic();
      temp_lock1 = true;
    }
  }
  else if(button == Skip)
  {
    //Next
    if(music_number == max_music_number)
    {
      music_number = 1;
      PlayMusic(music_number);
    }
    else
    {
      music_number++;
      PlayMusic(music_number);
    }
  }
  else
  {
    Display("Incorrect or improper parameter passed to function (MUSIC)");
    Wait(5000);
    QuitGame(0);
  }
}


The spawning system for the game's enemies

Code: ags

function SpawnEnemies()
{
  bool enemy_direction = false;
  int randbool = Random(1);
  if(randbool == 1) enemy_direction = true;
  //Basically, I'm doing what I took what I did to the player character (use a boolean variable to determain
  //whether the player is facing left or right), and applied it here to see what side of the screen the 
  //enemies spawn from. This just seem the easiest (and fastest) way to do it.
  int loopcheck = 1;
  while(1)
  {
    if(object[object_number].Graphic == 0)
    {
      if(enemy_direction) object[object_number].X = 0;
      else object[object_number].X = 800;
      object[object_number].Y = 400;
      if(object[object_number].X < player.x)
      {
        object[object_number].SetView(3, 2, 1);
        object[object_number].Animate(2, 3, eRepeat, eNoBlock, eForwards);
      }
      else
      {
        object[object_number].SetView(3, 1, 1);
        object[object_number].Animate(1, 3, eRepeat, eNoBlock, eForwards);
      }
      object_number += 1;
      return 0;
    }
    else if(object[object_number].Graphic == 38) return 0; //If the player is still living when there are 40 enemies, I'll be impressed. But just incase, this stops the game from (possibly, I haven't tested) crashing
  }
}

ddq

Downloaded and played for a bit.

Interesting experiment, indeed! I like where you're going with this, (the arcade collection), and this little game works pretty well, considering it was created in a design environment for adventure games. If I could throw in a little feature request, it might be nice to have the ability for either the player or both player and enemies to duck.

Darth Mandarb

#2
Please provide two in-game screenshots as the Forum Rules require or I will have to lock this...

Thanks


Since there is only one room this will suffice, thanks for the update.

suicidal pencil

#3
Quote from: ddq on Wed 19/08/2009 03:08:47
...If I could throw in a little feature request, it might be nice to have the ability for either the player or both player and enemies to duck.

interesting. Will definitely consider it, since it would add a new layer of depth to the game, with the enemies ducking your bullets from time to time.

Quote from: Darth Mandarb on Wed 19/08/2009 03:43:26
Please provide two in-game screenshots as the Forum Rules require or I will have to lock this...

Thanks

sorry bout that. Only one room, and not much to actually see. Yet.

suicidal pencil

Working on this game on and off. You can probably tell by the frequency of which I update it, but I'm still working on it!

SMF spam blocked by CleanTalk