Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - suicidal pencil

#1
This is really [EXPLETIVE DELETED] annoying...

Whenever I call "player.BlockingWidth", it's always zero. I can set it but because the width changes with the character animation, it can't be static. It isn't called or set in any other part of the script. Changing the sprite doesn't change the blocking width. I've even changed the graphics driver and colour depth to see if it'd do anything (it didn't). Solid & Clickable are set to true for the character.

What would cause this to be set to zero (without me actually setting it to zero), instead of the width of the sprite that the player is?
#2
I think that's a better way of saying that AGS error'd.

I haven't opened it in about 3 weeks, having been road-tripping around Ontario for work purposes. So when I decided to work on my game again AGS vomited this error at me.


I'm using Drake's Draconian edition of AGS, and my OS is Windows XP sp3. I'm going to remove & reinstall AGS and try opening it with the vanilla version, and then try it with the Draconian edition again. I'll report back with what happens, but any insight into this would be greatly appreciated.

Now, if you'll excuse the outburst:


#3
AGS Games in Production / SPE: The experiment
Sat 04/02/2012 18:15:15
The experiment being an attempt to create an AGS game with as much of the content that I can get away with randomly generated when the game starts ;D when I say as much as I can get away with, no part of the game and it's content will be unmolested by randomness.

Now of course, there are constraints: there will be a theme to stick to (hint: think apocalypse), and there are some things that I can't really randomly generate properly or at all in AGS (sound and music. I think it could be possible but I'm not willing to spend the time on that...yet), and of course the constraints AGS comes with (like only 40 objects per room, 30000 sprites, etc.), but that's part of the fun: seeing how much I can twist AGS before it breaks.

It's called 'SPE' just because I haven't thought of a name for it yet, and I'm trying to retain at least a little bit of ambiguity for what the final product will look like, even though I'll be sharing it's development every step of the way.

Enough with the rambling, below is the current information available for it. I'll try and keep at least a weekly update both on the development blog and here. updated February 12th, 2012

The development blog is here: http://bigfiredev.blogspot.com/

latest post: "State of the project 2
latest build (0-01) is available here
source of that build (0-01) is available here

snapshot of progress: February 12th, 2012
Quote from: Dev blog
Progress
Level Generator / design ~= 15%
Story and Theme ~= 2%
Player ~= 80%
Enemies = 0%
Objects = 0%

This project is in it's infancy so don't expect something spectacular until I sink more and more time into it  ;) As well, I'm in the middle of refactoring the level generation code and the latest build doesn't reflect this yet. Code refactored the way I like it. Now to making it do some more fun stuff

latest images

The level generator is working much better now!...but the doors are still being a little annoying


first look at how the game is going to look


Another attempt at generating the map


how the generated map will look, and it's data structure


Obviously there's a long way to go yet, but I think the project is an interesting enough idea as it is to warrant discussion. Comments and criticism are welcome. Right now, the only thing the level generator is doing is creating the starting sector, the doors to that sector, and placing another side room behind those doors. There is currently no method of opening doors and the basic implementation of collision detection for the player stops him from moving past the starting sector, but I'm working on this. The level generator is doing a bit more then that now. The challenge now is to tweak how it's going about it, and add a few more level segment types to the mix. Once I have a basic version of the level generator working the way I want it to, I'm going to start putting in some enemies to spice the game up a bit, and work on a basic form of "AI' for them.

Progress is being made, no matter how hard qptain_Nemo tries to distract me on IRC  ;D
#4
Now, I am willing to admit that my math sucks. Pretty bad, but almost every math problem I encounter I can usually work through by bashing my head against it. This problem, so seemingly simple, has made my procedure end in a concussion, instead of success.

here's a visual representation of what I'm doing:


Let me explain:

  • The intersection of the blue dashed lines is the origin of every line (400, 300)
  • The red lines represent the known line
  • The yellow lines represent the extrapolated path of the red lines
  • Where the red lines turn into yellow lines is the location of a mouse click
  • The end of the extrapolated line will always be at the screen edge, never farther.
The issue I'm having is accurately extrapolating that line. My first attempt at a solution was relatively simple: get the slope, increment/decrement x which changes y, and keep going until I hit an edge. Slow and time consuming, but at the time I was just looking to brute force it so I could continue on other stuff (optimization comes later). However, the results are far from accurate. Depending on where the click happens, the end of the extrapolated line is in the thousands, or it's a location in the completely wrong direction.

Could someone advise me on what I've done wrong? Code below.

Code: ags

  function ExtrapolateShot(float x1, float y1, float x2, float y2)
  {
    //x1 and y1 represent the origin
    //using floats for accuracy
    float rise;
    float run;
    int xdirection = 1; //which way x is going to move, 1 = positive
    
    //debugging...
    DL7.Text = String.Format("x1 %f y1 %f x2 %f y2 %f", x1, y1, x2, y2);
    
    if(x1 > x2)
    {
      run = x1-x2;
      xdirection = 0;
    }
    else run = x2-x1;
    if(run == 0.0) return 0; //just catching the error, to be removed
    
    if(y1 > y2) rise = y1-y2;
    else rise = y2-y1;
    
    float slope = rise/run;
    float eX = x2;
    float eY = y2;
    String EdgeCoor;
    
    while(eX > 0.0 && eX < 800.0)
    {
      if(eY < 0.0 || eY > 600.0)
      {
        EdgeCoor = String.Format("%f %f", eX, eY);
        DL8.Text = String.Format("%f %f y", eX, eY); //debug
        return EdgeCoor; //I'm aware that I can't return strings, this is just to show where the function can escape
      }
      
      if(xdirection == 1) eX += 1.0;
      else eX -= 1.0;
      
      eY = eX*slope;
    }
    
    EdgeCoor = String.Format("%f %f", eX, eY);
    DL8.Text = String.Format("%f %f x", eX, eY); //debug
    return EdgeCoor;
  }


I'm also trying to keep the code flexible so that the origin can move around the screen (instead of being stuck at 400,300), but while the code doesn't work this is of little concern.
#5
I've been dreaming about making a Guitar Hero clone on AGS, but I've never really known where to start. After searching around and finding no evidence of anyone succeeding at it yet, I still have no idea where to start, but I'm going to give it a try  :D

So presenting...


Details:

Name: AGS-Guitar Hero
Version: 0 (only just started :P)
Release: soon! I promise!

Basically, I'm making this game as a coding challenge for myself, and to try and twist the arm of AGS as hard as I can and see what happens. It will do everything that you can do in Guitar Hero right now, with three notable exceptions: There will be a 7th note (the 'open string' note), You will be able to make a Guitar Hero version of your favorite songs (basically, a song editor), and most importantly: the source will be available! I love looking at the source code of modules and games because I like to see how people solve certain problems, so I'm letting everyone who wants to take a gander at it ;)

To Do List

Game Engine
  • Song file parsing (100%)
  • Create Song editor (50%)
  • Create graphics (40%)
  • Player Input (50%)
  • GUIs (50%)
    Gameplay
  • Hammer-ons / pull-offs (0%)
  • Whammy Bar (0%)
  • Star Power (0%)
  • Note hit checking (0%)
The graphics are just rough versions, just so I can get a working version. Here's what it looks like so far:

The main screen


The notes




Dev. Journal

March 10, 2010

  • I've figured out two possible ways to format the song data. The first is the easiest to read and understand, the second...not so much. The former is a slight variation on guitar tabs, and the latter is a format looking like (24)------(1)xxx(46)-(13)-(24) etc... with the numbers representing the notes (1 for first fret, 2 for second, etc), dashes representing open space, and x representing holds. I started out doing the first design, but I'm going to use the second design, since it will take 6 times longer to parse the first design (unless I can parse 6 lines at once...), and 6 times smaller. As well, after the file is parsed, the note locations are held in temporary storage (aka, arrays) so that it's easy to recall the information on the fly. However, these arrays are going to be big. If it takes 0.5 seconds for a note to travel from the top to the bottom (twenty frames), and there is an array element for each frame of the song, a 5 minute long song will need 12000 elements (each note position is one frame)  :o Even better, is that there are 7 arrays that would be that long (164.0625 Kb of space required JUST for that :P) Even then, I think I'll make the song time limit 10 minutes (24000 elements, 328.125 Kb). I have another little obstacle to overcome: I need to make the song editor first, so I can create songs and then test the file parsing, and play the game  :P

March 12, 2010
  • This is turning into a monster to code. It's not terribly complicated (at least, from my point of view (working excessively in Perl has lent me some skill in file parsing :P)), but there sure is a lot of it. It's just too bad that AGS doesn't support Regular Expressions. Take this example: The beginning of every song first starts out with a bunch of information about the song (what number it is, the name, and the length). Here's how I'm parsing it in AGS (ripped straight out) (:
Code: ags

.
.
.
    Offset = 0;
    String Line = SongList.ReadRawLineBack(); //get the entire line into the game memory
    String LineChar = Line.Substring(Offset, 1); //This variable points to a single character in the line
    
    if(LineChar == "I") //the line with the song information (song name/number) is started with an 'I'
    {
      
      SongFound = true;
      Offset += 3;
      LineChar = Line.Substring(Offset, 1);
      
      while(LineChar != "}") //I'm assuming that the user wont mess around with the song file
      {
        
        StringNumber.Append(LineChar);
        Offset++;
        LineChar = Line.Substring(Offset, 1);
        
      }
      
      //I have to deal with the 'a' at the beginning of the string.
      String TrimStringNumber = StringNumber.Substring(1, StringNumber.Length-1);
      songnumber = TrimStringNumber.AsInt;
      Offset += 3;
      LineChar = Line.Substring(Offset, 1);
      
      while(LineChar != ")")
      {
        
        SongSelect_SongName.Append(LineChar);
        Offset++;
        LineChar = Line.Substring(Offset, 1);
        
      }
      
      SongSelect_SongName = SongSelect_SongName.Substring(1, SongSelect_SongName.Length-1);
      Offset += 3;
      LineChar = Line.Substring(Offset, 1);
      
      while(LineChar != ")")
      {
        
        SongSelect_Length.Append(LineChar);
        Offset++;
        LineChar = Line.Substring(Offset, 1);
        
      }
      
      SongSelect_Length = SongSelect_Length.Substring(1, SongSelect_Length.Length-1);



now, here's the same stuff done in Perl with Regular Expressions

Code: ags

if($_ =~ /^I (\d) {(\w)} (\d)/)
{

  $SongNumber = $1;
  $SongName = $2;
  $SongLength = $3;

}


MUCH simpler, and more compact :P (edit: I actually found a semantic error in my code after posting...)
more to come!


March 16, 2010
  • I'm about halfway done the song creator for the game. It's only now, though, that I realized something: In order to let people create their own songs, they'll need the source. When the game compiles, all the music is stored in the music.vox file...and I'm pretty sure that there is no way to add to it after it's compiled. This isn't that much of a problem though, seeing as I was going to release the source anyways  ;D .  That aside, it seems that the bulk of my worries is in getting the songs to line up with the notes. Even in the song editor, this promises to be a pain.
#6
This problem kept popping up, but I could ignore it until I did the background with an object. Basically, it seems that object[a], when it is clipping of object[c], and when object[a] has a higher y value than object[c], with object[a]'s y value being higher by approx. 2/3 to 1/2 of object[a]'s y value, object[a] will clip behind object[c], no matter what object numbers they are.

It's also constant for all objects.

Here's a few examples:



This object is serving as an animated background with 78 frames. No matter what speed I put it to, it cuts the animation, and displays the first frame and doesn't change. Look where the red arrow is pointing to see it better :P



Here's one shot of one object above another.



Now here it switched up

I've looked everywhere in the help and forums, and there doesn't seem to be anything regarding this.
#7
For one of my games, I needed to hack together an object collision system..and I did. It works, but with the exception of one case.

Working along side the normal object array, I have a second one, which tracks what type of object it is (player, turret, bullet, etc.). It works fine with the turrets and the bullets...but not the player. The element positions in both arrays are one in the same, (array1[element] == array2[element]), to make it easy to track objects. The player object is element 0 in the object array and the settings array, and the value in the settings array is 6, for the player. A setting of 1 is a turret, 3 is a bullet fired from the player, etc.). Any case involving the player object fails, and every other works.

Here's the code:
Code: ags

function ObjectCollisions()
{
  int object1 = 0;
  int object2 = 0;
  while(object1 <= 39)
  {
    object2 = object1+1; //so I'm not checking collisions twice
    while(object2 <= 39)
    {
      if(object[object1].IsCollidingWithObject(object[object2])) //collision detected
      {
        if(ObjectSettings[object1] == 6) //player
        {
          if(ObjectSettings[object2] == 4) //enemy bullet
          {
            DoDamage(object1, 1);
            ReleaseObject(object2);
          }
        }
        else if(ObjectSettings[object1] == 3) //player bullet
        {
          if(ObjectSettings[object2] == 1) //turret
          {
            DoDamage(object2, 1);
            ReleaseObject(object1);
          }
        }
        else if(ObjectSettings[object1] == 1) //turret
        {
          if(ObjectSettings[object2] == 3) //player bullet
          {
            DoDamage(object1, 1);
            ReleaseObject(object2);
          }
        }
        else if(ObjectSettings[object1] == 4) //enemy bullet
        {
          if(ObjectSettings[object2] == 6) //player
          {
            DoDamage(object2, 1);
            ReleaseObject(object1);
          }
        }
      }
      object2++;
    }
  object1++;
  }
  return 0;
}


The code for collisions for the player, the turrets, and the bullets are identical, yet it fails on one very specific case.

Any thoughts?
#8
In one of my latest endeavors, I'm using objects as bullets. When a certain function is called, it should get a free object, set it's position to the top-center of the player, and change it's graphic. When the function is called, however, nothing happens. I put a 'Display()' just before the return statement at the end of the function, and it displayed, so it's running through the function, but it's not doing anything else other than that.

here's the offending function
Code: ags

function SetUpPlayerBullet()
{
  if(TotalBullets == 25) return 1; //need to see if the onscreen bullet cap was hit
  int FreeObject = GetUnusedObject();
  ObjectSettings[FreeObject] = 3;
  object[FreeObject].X = player.x+51;
  object[FreeObject].Y = player.y+173;
  object[FreeObject].Graphic = 11;
  BulletDirection[FreeObject] = 0;
  TotalBullets++;
  return 0;
}


and here's how I'm finding the next available object, the function being called on the 4th line.

Code: ags

function GetUnusedObject()
{
  int counter = 0;
  while(counter <= 39)
  {
    if(object[counter].Graphic == 0) return counter;
    else counter++;
  }
}


This has worked for me in the past for previous games...but not now for some odd reason  :-\
#9
Is there a way to mess around with objects outside their room? Some of the games I currently have on the burner have an extreme amount of use and abuse of objects, and I'd like to make a module for the plethora of functions that have been made for these games, but I'm not completely sure this is possible.
#10
I need to calculate the inverse sine. For the formula sin(x) = a/b, I have a and b, but I need to figure out the angle, and I don't think that AGS has a built-in sin-1(x) function.
#11
Advanced Technical Forum / I broke AGS...
Sun 15/11/2009 06:07:54
---------------------------
Illegal exception
---------------------------
An exception 0xC0000005 occurred in ACWIN.EXE at EIP = 0x00506B3B ; program pointer is +5, ACI version 3.12.1074, gtags (0,50)

AGS cannot continue, this exception was fatal. Please note down the numbers above, remember what you were doing at the time and post the details on the AGS Technical Forum.



Most versions of Windows allow you to press Ctrl+C now to copy this entire message to the clipboard for easy reporting.

An error file CrashInfo.dmp has been created. You may be asked to upload this file when reporting this problem on the AGS Forums. (code 0)
---------------------------
OK  
---------------------------

Here's what happened: I have a function that accelerates the player downwards, and is eventually stopped when they hit the ground.

Code: ags

function Downward_acceleration(int Acceleration, int StartingVelocity)
{
  //a = (v2-v1)\t 
  //Acceleration equals Final Velocity minus Initial Velocity over Time
  //v2 = at+v1
  //Final Velocity equals Acceleration multiplied by Time plus initial velocity
  int FinalVelocity = (Acceleration*1)+StartingVelocity;
  return FinalVelocity;
}
.
.
.
function repeatedly_execute() 
{
  if(Ground_collision == false)
  {
    player.y += Downward_acceleration(YA, YV1);
    YV1 += Downward_acceleration(YA, YV1);
    if(YA <= 3) YA++;
  }
}


Only, when I tested it, I had accidentally put '-=' instead of '+=' in the line 'player.y += Downward_acceleration(YA, YV1);'. So instead of traveling downwards, where the player would have stopped, the player launched into the sky, and eventually produced the error above

thoughts?
#12
Name: Platform Horde
Current Version: 0.98
Last Update: November 12, 2009 @ 18:45 EST
0.98 Release: http://www.mediafire.com/?thqgee2m0rg
0.98 Source: http://www.mediafire.com/?uijnthyoamz

0.92 to 0.97 changes

  • Changed options GUI
  • Changed enemy spawning system from random number generation (Spawn enemy when variable x is a number between y and z) to a cycled one (every x game cycles, spawn enemy)
  • Changed what happens when player dies
  • fixed minor bugs
  • Running tally of frags now kept
0.97 to 0.98 changes

  • Fixed minor errors
  • Added two more weapons
  • Added a simple cash system, and a shop
  • Added enemy death and hurt sounds
Game Info
Latest Dev. News (November 12, 2009 @ 18:45 EST):
Feedback on these ideas are more than welcome. In fact, they're wanted.

  • Probably going to switch systems for dealing with the bullets
  • I'm thinking about reducing the total amount of enemies allowed on screen from 39 to 35, so I can use the extra 4 room objects as bullets. There's only one object allowed to be the bullet, and there can be a noticeable slow-down in the player's firing when there are many enemies, and the player is leaning on the fire button.
  • I think adding a leveling system and a shop with different weapons would really make the game better, in that it would add more depth to the game.
  • Someone suggested adding a 'duck' feature for the player and the enemies. It would definitely make the game harder.
  • More enemy classes and types?

    Pop open the champagne , I've finally completed my first game...after about a full year using AGS. There is no story to worry about, for this is an arcade style game, meant to be played for high score, not story. I'm going to be making constant updates to the game, in the style of patches, to make it easier to get newer versions out to you fine, fabulous people  :P I kinda wish that AGS had internet capability, because I could do so much more, but this is not the forum or post to bring it up.



    As you can see, I still have a wee bit of work on finishing up the character sprites. There are 4 backgrounds (which one you see is randomly decided), which are my screen shots from Unreal Tournament, and Doom II. The enemies and player were created by me (it shows, I'm a horrible graphic artist).

    I am handing out the source code so that people can critique the code, design, and everything else about it. Plus, you can add your own music into the game, just by putting the file in the folder, renaming it, and compiling. The game automatically detects and adds it to the playlist. It supports only MIDI music at the moment, so avoid using .mp3 files or anything else.



    The game also allows you to change the difficulty by adjusting the properties of enemies. So far only three properties are changeable: Health, Spawn rate, and the number of frags required before they change automatically.

    To Do List:

    • 2 player
    • More weapons
    • Increased customization of enemies
    • Crouching
    • Power-ups?
    • Wave system?
    • More sounds!
    • More music!
#13
Advanced Technical Forum / Gui from a script
Tue 08/09/2009 21:38:00
is there any way for me to create a GUI and it's buttons purely from a script, without having to create it in the AGS editor first?
#14
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
  }
}
#15
ETA For first mission (and full demo): April 15, 2009

mission one progress
Rooms: 1/14 (7.1 %)
Characters: 20/20 (100%)
Sprites: 128/180 (71%)
Coding: 15% (anticipating from 3975 to 2250  lines of code (125-50 per room, 250-350 for 6 rep.execs, 125-50 for special actions )
*all above are estimations*


DEMO
Press 'ctrl-q' to quit at any time.
'M' brings up the menu
right click switches mouse modes (normally it would anyways, but I messed with the code to better suit what I needed)

http://www.mediafire.com/download.php?i3uxmnjw0om

Story so far...
You are Agent X4a61636f62J, a contract killer trained by the Ontario Guild of Assassins. Taking out targets around the world, you are one of the best. But after a routine mission sours and you are betrayed, you become the very thing you hunted. With the ultimatum they issued being a catch-22, your going to be lucky to survive another day.

The full game will be broken into three parts: Beginnings, Betrayal, and Climax. Currently, I'm working on 'Beginnings'. Instead of the side view of most adventure games, I decided to do a 'Birds Eye View' style game.


A few Screen shots with descriptions


The main title screen for the game. The cyan thing is the cursor


This is the home of agent X4a61636f62J in Toronto


The hospital where the first mission is located. See that small blue transparent thing just below the counter? those represent locations where the player can do stuff that help/hinder the mission (blue for talking sequence, green for action sequence, red for assassination sequence). Currently under development


The load out screen, where the player buys and chooses what they will take on the mission, which can have a huge impact on the mission itself. White represents an upgrade or weapon that hasn't been bought. Red is a weapon or upgrade that is not in use. Green is a weapon or upgrade currently in use. Currently under development

To Do:
-Add more options to the load out screen:
--9mm extended clip (9mm upgrade/Ammo)
--9mm firing mechanism upgrade (9mm upgrade, makes weapon fully automatic)
--.357 Magnum extended barrel (.357 upgrade, increases bullet velocity)
--.357 Magnum bullet holder (.357 upgrade, decrease reload time)
--Desert Eagle (handgun)
---Plastic Design (upgrade, undetectable to metal detectors)
---Silencer (upgrade)
---Armour Piercing rounds (upgrade/Ammo)
--Switchblade (Melee)
--Combat Knife (Melee)
--Garrot Wire (Melee)
--MP5 (Assault weapon)
--Lock picks (misc)
--Poison (misc)
--Sedative (misc)
--Concentrated Acid (misc)

-Work on Mission 1 Entrance
-- Speak-scene1
--Action scene1
--Rep.Exec function


Progress: About 10% done

Sounds and Music: I'm mostly ripping sounds from Counter-Strike and Half-life (1 and 2) (and yes, I own these games...), but I'm making the music myself. Progress: about 75%

Samples: http://www.mediafire.com/download.php?uiztzmmimmn
Password: FalconForty

Graphics: Mostly using GIMP 2.6.4 for the graphics. Progress: about 15%

Coding: I've noticed that I'm spending about 90% of my time actually coding the game, rather than making the graphics. Which is just as well, since I enjoy it immensely. Progress: 5%

Example code:
Code: ags

// room script file

import function Mission_load();

//The next function will take two objects, fade them in to view, and move them
//slowly to the opposite sides of the screen.  
function room_FirstLoad()
{
  Room4Mission1.Transparency = 100;
  Room4Deathbed.Transparency = 100;
  Shop.Visible = false;
  int Trans1 = 100;
  int Trans2 = 100;
  PlaySound(9);
  while(Trans1 < 101)//Just so that the loop doesn't exit prematurely
  {
    if(Trans1 != 0)
    {
      Trans1--;
      Room4Mission1.Transparency = Trans1;
      Room4Mission1.X--;
    }
    if(Trans1 <= 25)
    {
      if(Trans2 != 0)
      {
        Trans2--;
        Room4Deathbed.Transparency = Trans2;
        Room4Deathbed.X++;
      }
    }
    if(Trans1 == 0)
    {
      if(Room4Mission1.X != 0)
      {
        Room4Mission1.X--;
      }
    }
    if(Trans2 == 0)
    {
      if(Room4Deathbed.X != 230)
      {
        Room4Deathbed.X++;
      }
      else
      {
        Trans1 = 101; //Breaks the while loop
      }
    }
    Wait(1);
  }
  Trans1 = 0;
  Trans2 = 0;
  Room4Loading.Visible = true;
  while(Trans1 < 100)
  {
    Trans1++;
    Trans2++;
    Room4Mission1.Transparency = Trans1;
    Room4Deathbed.Transparency = Trans2;
    Wait(1);
  }
  Mission_load();
  Room4Loading.Visible = false;
  Protagonist.ChangeRoom(5, 402, 548);
}


I'm probably going to tighten up this section of the code later, but for now, I don't need to.

Story: I'm approaching the story from a different angle: Instead of making a story, and then shaping the game around it, I'm creating the game, and shaping the story around it. To me, this is a much better way of making a game. Progress: about 30%

Updates

March 20, 2009
- Finished Dialog between player and Secretary in Mission1
- about 80% done the coding for the rep.exec function
March 24, 2009
- Finished all possible player and guard animations
- Finished room 1 of mission 1
- starting on room 2 of 14 for mission 1

Comments and constructive criticism welcome
#16
gah.

On one of the many GUIs in my game, only one has text that has a variable in it. The text in question is supposed to show an integer value, but I can't even get it to compile. Even copy/pasting from the Help comes up with this error:

GlobalScript.asc(118): Error (line 118): Parse error in expr near '"Cash: %d"'

Here's the code:

Code: ags

  //set the cash monitor to the current amount of cash on hand
  ShopGuiCashMonitor.Text = ("Cash: %d", Cash);
  //display the now correctly formatted shop GUI
  ShopGuiBuy.Clickable = false; // The buy button is not visible, since nothing has been selected.
  Shop.Visible = true;


ShopGuiCashMonitor is a label. It works perfectly until I try to toss a variable at it.
#17
In the game I'm currently creating, when the user presses 's', their character will go into 'stealth' mode.

In stealth mode, their speed will decrease.

I already know that changing character speeds require that they are not moving. But, Instead of stopping them entirely, I want them to stop, change views, decrease speed, then continue on to where they were headed.

I've got everything down, except having the character continue on. I'm trying to save the x and y locations to two different variables, but I don't quite know how.

Here's the code, and where I'm having issues is marked by a triple asterisk (***).
What I added to existing code will be preceded by (&&&)

GlobalScript.asc
Code: ags


***int mouseXloc = mouse.x;
***int mouseYloc = mouse.y;
.
.
.
.
.
.
.
.

.
if (keycode==83){
    if (STEALTH_S == false){ //where STEALTH_S is a global variable
      STEALTH_S = true;
      if (player.Moving == true){
        player.StopMoving();
        SPencil.ChangeView(2);
        SPencil.SetWalkSpeed(3, 3);
        player.Walk(mouseXloc, mouseYloc, eNoBlock, eWalkableAreas);
      }
      else if (player.Moving == false){
        SPencil.ChangeView(2);
        SPencil.SetWalkSpeed(3, 3);
        }
  }
    else if (STEALTH_S == true){
      STEALTH_S = false;
            if (player.Moving == true){
        player.StopMoving();
        SPencil.ChangeView(1);
        SPencil.SetWalkSpeed(6, 6);
        player.Walk(mouseXloc, mouseYloc, eNoBlock, eWalkableAreas);
      }
      else if (player.Moving == false){
        SPencil.ChangeView(1);
        SPencil.SetWalkSpeed(6, 6);
        }
}
}
.
.
.
.
.
.
.
.

.
function on_mouse_click(MouseButton button) // called when a mouse button is clicked. button is either LEFT or RIGHT
  {
  if (IsGamePaused() == 1) // Game is paused, so do nothing (ie. don't allow mouse click)
    {
    }
  else if (button == eMouseLeft) 
    {
    ProcessClick(mouse.x,mouse.y, mouse.Mode);
    (&&&) mouseXloc = mouse.x;
    (&&&) mouseYloc = mouse.y;
    }
  else // right-click, so cycle cursor
    {   
    mouse.SelectNextMode();
    }
  }
.
.
.
.
.
.
.

#18
Two part question, all about functions.

part A) Can you have a recursive function (Have the function call itself)?

and

part B) Can you have a function call another function? (having 'function DoThis()' use 'function DoThat()', then continue on)?

SMF spam blocked by CleanTalk