Users browsing this thread: 1 Guest(s)
PBG's ADVENTURE! (Yeah!)
#1
LATEST BUILVery Sad https://www.dropbox.com/s/lhm2ytlwfai7s8...1.exe?dl=0

FRICK IT.

ALPHA TEST 1: I'm making this a thing. It is a thing. I'm rebuilding the engine, as the previous engines coding was a big mess of text. I've sorted it out, and so far it's working out. What you'll see is a test room with the current sprite set. No tileset however.
Controls are simple;
WASD=Move
Space=Jump
Shift=run

I'll be adjusting the run to use momentum soon. Now, what would be the best way to make:
-a frame long landing sprite
-a heart based health bar
-text boxes RPG style

UPDATE: tiles and placeholder background added, sword added.
Aerial spin attack i-- EDIT: Added aerial spin attack with place holder sprite.

UPDATE 2: Aerial attack has a new sprite, you can roll if you use the attack close enough to the ground. Hold K to use the attack longer. Added platforms you can jump through. One test ball enemy. Use F8 to restart the test. Hurt sprite is WIP.
[Image: rHiHaRN.jpg]
Reply
Thanked by: TheShyGuy
#2
So, I won't be including SpaceHamster like I intended. This'll be a game based mainly around PBG. So... Does anyone have a good editable Zelda based heart system and RPG text box system?
[Image: rHiHaRN.jpg]
Reply
Thanked by:
#3
So... I need help with the health system. It's gonna be a Zelda like health system. I have the variables down, but I'm not sure how to actually draw the hearts. In specific:
-Drawing the amount of hearts PBG has
-making a new row every 10 hearts......-
Well, if you played Zelda, you know what I'm going for. I'd love some help making this code.
[Image: rHiHaRN.jpg]
Reply
Thanked by:
#4
Are you unsure of of to set up the code for a health system, or just specifically rendering hearts appropriately?

How do you track the current health? Since each heart has a smallest value of 1/4, you can use integers to represent health. For every 4 whole numbers, you have 1 whole heart. Doing this makes it easier to render than using decimal numeric types and comparing decimal values like .25, .5, .75, etc. You can use the % (remainder) operator like so:

wholeHearts = totalHealth / 4; //integer math, so 3/4 = 0 whole hearts.
fractionalHearts = totalhealth % 4; //Ex) 5 % 4 = 1, 4 % 4 = 0, 3 % 4 = 3

For the fractionalHearts, you render whatever sprite represents the fraction, 1 -> 1/4, 2 -> 1/2, 3 -> 3/4.

To render new rows of hearts, you can probably iterate over all your hearts when rendering while tracking the total. If the total is greater than the max row size, then you reset the render position and offset in the YAxis.
Animations - MFGG TKO (scrapped) - tFR
[Image: QUmE6.gif]
"It feels that time is better spent on original creations" - Konjak
Focus on the performance, the idea, not the technical bits or details - Milt Kahl
Reply
Thanked by: Joxon
#5
:p Welp, I shoulda mentioned that I'm not using half and quarter hearts... I wasn't planning on needing half hearts. I'd just prefer it slightly simpler. Each heart is a hit basically. I don't think any attacks would take more than 3 hearts.

Anyways, I need help rendering the hearts. I keep track of it using two variables: hp and maxhp, both set as global variables. Obviously collecting a heart container adds to maxhp by one. It's "simple". I need code that'll render the total amount of hearts, which hearts are empty, and it to render a new row every 10 hearts Cute Thanks to anyone that helps!
[Image: rHiHaRN.jpg]
Reply
Thanked by:
#6
I was gonna explain it, but this little section of code should show a solution much quicker:

Code:
//I assume that hp and maxhp are whole integer values and that each of these variables are defined
    short hp, maxhp, maxHeartsPerRow;
    short cellX, cellY, cellPixelWidth, cellPixelHeight;
    short wholeHeartSpriteID, emptyHeartSpriteID;

    //originX and originY are the top left position to begin rendering hearts from.
    short i;
    short originX, originY, posX, posY;

    /*
    Imagine the hearts being rendered in cells like in a tile grid.
    CellX, CellY refer to their cell index. Using i, the number of
    hearts rendered, we can determine the position to render each heart.
    */
    for (i = 0; i < maxhp; i++)
    {
        cellX = i % maxHeartsPerRow;
        cellY = i / maxHeartsPerRow;

        posX = cellX * cellPixelWidth + originX;
        posY = cellY * cellPixelHeight + originY;

        if (i < hp)
            RenderSprite(wholeHeartSpriteID, posX, posY);
        else
            RenderSprite(emptyHeartSpriteID, posX, posY);
    }
Animations - MFGG TKO (scrapped) - tFR
[Image: QUmE6.gif]
"It feels that time is better spent on original creations" - Konjak
Focus on the performance, the idea, not the technical bits or details - Milt Kahl
Reply
Thanked by: Joxon
#7
Now, are any of those functions that aren't supported by GameMaker 8.0...? Another thing i shoulda mentioned earlier...
[Image: rHiHaRN.jpg]
Reply
Thanked by:
#8
Oh yeah, they're just psuedo functions. Look at the overarching idea. You determine the XY location of each heart by using it's index. The way its calculated causes hearts to begin a new row every 10 hearts, full or empty. After you find the location, you just use whatever GM function you know of to render the appropriate sprite.
Animations - MFGG TKO (scrapped) - tFR
[Image: QUmE6.gif]
"It feels that time is better spent on original creations" - Konjak
Focus on the performance, the idea, not the technical bits or details - Milt Kahl
Reply
Thanked by: Joxon
#9
Alright... What's the Short function for? That was my main concern.
[Image: rHiHaRN.jpg]
Reply
Thanked by:
#10
The only function is "RenderSprite(...)". The rest of the names are just integers.
Animations - MFGG TKO (scrapped) - tFR
[Image: QUmE6.gif]
"It feels that time is better spent on original creations" - Konjak
Focus on the performance, the idea, not the technical bits or details - Milt Kahl
Reply
Thanked by:
#11
Ok, so, what is the reasoning for listing the variables at the top after the word "short"?

Code:
short hp, maxhp, maxHeartsPerRow, i;
    short cellX, cellY, cellPixelWidth, cellPixelHeight;
    short wholeHeartSpriteID, emptyHeartSpriteID;

Is this setting variables or...?

Also, what would I replace cellX/cellY, cellPixelWidth/height with? Or should I replace them at all?
[Image: rHiHaRN.jpg]
Reply
Thanked by:
#12
Declaring the variables in a list like that only shows that the following variables are all of the same type.

Code:
//I assume that hp and maxhp are whole integer values and that each of these variables are defined
    short hp, maxhp, maxHeartsPerRow;
    short cellPixelWidth, cellPixelHeight;
    short originX, originY;
    short wholeHeartSpriteID, emptyHeartSpriteID;

    //originX and originY are the top left position to begin rendering hearts from.
    short i;
    short posX, posY;
    short cellX, cellY;
Note that I moved "originX" and "originY" to the group of variables that you set yourself, and moved "cellX" and "cellY" to the group of variables that are determined within the loop which you do not set yourself. For the first group, I assume that you have all of these values and can set them. "originX" and "originY" represent the starting position to render the hearts at. "cellPixelWidth" and "cellPixelHeight" represent the size of each heart, though the values can include some padding (be larger than the sprite sizes).
Animations - MFGG TKO (scrapped) - tFR
[Image: QUmE6.gif]
"It feels that time is better spent on original creations" - Konjak
Focus on the performance, the idea, not the technical bits or details - Milt Kahl
Reply
Thanked by:
#13
Dammit, I updated my post after you post a reply to it. Fortunately you answered the question anyways. Alright, thanks for clearing that up!

EDIT: One last thing, whats the % for?
[Image: rHiHaRN.jpg]
Reply
Thanked by:
#14
It's the remainder operator. It's the value that you would get after long division and getting a remainder. So:

7 % 3 = 1
6 % 3 = 0 (no remainder from 6 / 3)
5 % 3 = 2
4 % 3 = 1
3 % 3 = 0
2 % 3 = 2
1 % 3 = 1
0 % 3 = 0

___

I'll make something real quick to show how it's used to find cellX.
Animations - MFGG TKO (scrapped) - tFR
[Image: QUmE6.gif]
"It feels that time is better spent on original creations" - Konjak
Focus on the performance, the idea, not the technical bits or details - Milt Kahl
Reply
Thanked by:
#15
Well, the problem is, i don't believe there's anything with that function in GameMaker.
[Image: rHiHaRN.jpg]
Reply
Thanked by:


Forum Jump: