New version released.
The next release will be 1.0, and it will be the final .exe release before I start using patches.
The next release will be 1.0, and it will be the final .exe release before I start using patches.
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 MenuQuote from: wonkyth on Wed 09/09/2009 11:47:00
...Unless you wanted slower moving bullets, like if you wanted the player to have to time their shooting of the gun, and to allow dodging and the like.
Quote from: Khris on Tue 08/09/2009 22:40:30
Do you want to create a module that needs a GUI?
Quote from: Vince Twelve on Tue 08/09/2009 21:17:49
Only if the gun can only be fired in one room. Otherwise, you'll have to create the bullet objects in every playable room. Apart from this being slightly more work, you may want or need that object for something else in the room.
Quote from: Scorpiorus on Sat 05/09/2009 03:28:20
I'd go with using characters to simulate bullets so not to complicate things too much for a start.
function GunFire()
{
if(player.Loop != 1)
{
if(player.Loop != 2)
{
if(direction == true)
{
//firing RIGHT!!!
//I made sure that object 39 is not used as an enemy, so it can be used as a bullet.
//I also need to make sure that the player is ACTUALLY FIRING HIS GUN
bulletlock = true;
if(object[39].Graphic == 0)
{
object[39].X = player.x;
object[39].Y = player.y - 75;
object[39].Graphic = 130;
}
else return 0;
}
else
{
//firing LEFT!
bulletlock = true;
if(object[39].Graphic == 0)
{
object[39].X = player.x - player.BlockingWidth;
object[39].Y = player.y - 75;
object[39].Graphic = 130;
}
else return 0;
}
}
}
}
.
.
.
//This will move all of the objects on screen
function ObjectMove()
{
//this moves and controls all of the enemies
int enemy_number = 0;
while(enemy_number < 39)
{
if(object[enemy_number].Graphic != 0)
{
if(object[enemy_number].X < player.x) object[enemy_number].X++;
else object[enemy_number].X--;
}
enemy_number++;
}
//this controls the bullet
if(object[39].Graphic != 0)
{
if(direction == true)
{
//The player is facing right
object[39].X += 100; //move the bullet
if(object[39].X <= 800)
{
int object_check = 0;
while(object_check <= 38)
{
if(object[39].IsCollidingWithObject(object[object_check]))
{
DoDamage(object_check);
return 0;
}
else object_check++;
}
return 0;
}
else
{
object[39].Graphic = 0;
bulletlock = false;
}
}
else
{
//The player is facing left
object[39].X -= 100; //move the bullet
if(object[39].X >= 0)
{
int object_check = 0;
while(object_check <= 38)
{
if(object[39].IsCollidingWithObject(object[object_check]))
{
DoDamage(object_check);
return 0;
}
else object_check++;
}
return 0;
}
else
{
object[39].Graphic = 0;
bulletlock = false;
}
}
}
}
Quote from: Nightblade on Tue 08/09/2009 18:26:15
@Suicidal Pencil
Thanks for sharing the source code.
This will be very useful to me as part of my game will be a platformer.
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.
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
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.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 pencilQuote 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.
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);
}
}
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
}
}
.
.
.
@2
JOSH: Thanks for saving my dog! Here's the $10 I owe you
Cash += 10; // hit tab, then write your code
EGO: No problem!
return
.
.
.
.
.
.
@2
JOSH: Ok, I'll trade my gum for your chocolate
player.AddInventory(Gum);
player.RemoveInventory(Chocolate);
return
.
.
.
// 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);
}
By continuing to use this site you agree to the use of cookies. Please visit this page to see exactly how we use these.
Page created in 0.097 seconds with 16 queries.