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

Messages - McMonsterBrothers

#1
Quote from: monkE3y_05_06 on Fri 08/07/2011 06:28:07
This has actually been asked many a time. It's relatively simple to store current and max health levels in int variables. You can also use extender methods to link your variables into your characters, which is primarily aesthetic, but is nice for organization and such. :)

Code: ags
// Script.ash

import int GetHealth(this Character*);
import int GetMaxHealth(this Character*);
import void SetHealth(this Character*, int health);
import void SetMaxHealth(this Character*, int maxHealth);

// Script.asc

int character_health[];
int character_max_health[];

function game_start()
{
  character_health = new int[Game.CharacterCount];
  character_max_health = new int[Game.CharacterCount];
}

int GetHealth(this Character*)
{
  return character_health[this.ID];
}

int GetMaxHealth(this Character*)
{
  return character_max_health[this.ID];
}

void SetHealth(this Character*, int health)
{
  character_health[this.ID] = health;
}

void SetMaxHealth(this Character*, int maxHealth)
{
  character_max_health[this.ID] = maxHealth;
}


Usage would then be something like:

Code: ags
player.SetHealth(80);


Of course you may want to add some checks to make sure health isn't set to exceed max health, but that's the basic gist of it.

As for displaying this on a GUI, there's various ways you could implement that. For example you could have a button with a background image set to represent full health, then simply change the button width according to the character's health percentage. So long as you have it set to clip the image then you now have a functioning health bar.

There's other ways to do it too of course, but it would depend exactly what you are wanting to achieve.

thanks dude!!! but is there a way that i can lower this health occording to if they get hit (like a fighting game)
#2
I am interested in making a sort of boxing game similar to Mike Tyson's Punch Out!!!! on the NES (Nintendo Entertainment System).  I was wondering how I would go about scripting in a sort of health on how different punches would take down a certain amount of health from the character being hit, and also when a person's health hits zero, the fall to the floor and require to get up before a certain amount of time.  And even if possible, how would i go about setting up a gui to represent how much health a person has???

Im sorry if this is not a beginner question lol
#3
thanks guys for your help  ;D i posted in the games in production forum about our upcoming game that i am working on.  it ain't much to look at, but its our first  8)
#4
Hello guys!

It's the McMonster Brothers here with our first video game.
Now, I'd like to say on behalf of both of us, we aren't the best artists.
But it's how easy and fun it is to play the game right?
So, we are working on our first game ever called:

The McMonster Brothers: Adventurer's Quest

In this game, you play as an Adventurer who wonders around his hometown of Lu Verne.
His simple goal is to do the tasks brought upon him that others request him to do.

Now, this game will feature crudely drawn backgrounds (because we aren't artists, so bear with that please), custom characters (for some of them, we have actual people pose for them, then use them as sprites, no drawing for them), and other sprites from common games you'd recognize.

All in all, they are based off of the personalities of our youtube videos that we make as the McMonster Brothers.
Very very dimwitted and vulger.  Yet comedic at times.

So we hope you guys go easy on us when you play this game when it is released later down the road.

Here are some sample screen shots:




If you would like to play our short beta (aka the demo) of the game (and by short, we mean short, only takes 5 minutes or less to beat) please reply saying you would like the link to it.  If no one wants to play the demo, we aren't going to bother putting the link.  But if you guys are somewhat interested, feel free to say so.

Thank you guys for reading this, and again, go easy on us, it is our first game!! XD
#5
Quote from: Iceboty V7000a on Wed 01/06/2011 07:24:20
No, if there is a single line of code you don't need the braces (though adding them there wouldn't hurt).

Also, your line shouldn't work either, as you've added a semi-colon that shouldn't be there:

if (oFruit.Visible == true); {
  Display ("There is no need to climb the tree.");
}


oops my bad lol thanks dude  ;D
#6
Quote from: FamousAdventurer77 on Tue 31/05/2011 02:05:48
I'm getting really confused now: I deleted that bit of code and replaced it with the old one (not the one I first posted, just a simple one-line Display message) and made sure that oFruit was initially visible in the Room's objects panel.

It still isn't when I run the test game. What went wrong...?  ???

Code: ags
if (oFruit.Visible = true) Display("There is no need to climb the tree.");
  I got a parse error when I tried this line.

i dont know if this helps but i think that you must put the {}'s in there like this:
Code: ags
if (oFruit.Visible == true); {
 Display ("There is no need to climb the tree.");

}
#7
Ok, i need help lol.

My problem is, I want to make it so a certain thing happens if the player uses a specific inventory item on a hotspot.
And I want something else to happen if the player uses anything other than that inventory item on that hotspot.

Can you please help?
I cant seem to figure out how to set it up so it will work properly, I know that it is probably easy, but this is my first game XD and I need all the help I can.
#8
thanks dude!!! much appreciated
#9
...while like in debugging mode? Before you make the .exe files for it.  When you are just testing the game out, is this possible? I know you view it fullscreen when it has been made into an .exe but what about testing purposes?  ???
SMF spam blocked by CleanTalk