Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

1402734 Posts in 68124 Topics- by 61741 Members - Latest Member: serges_games

September 25, 2022, 07:16:55 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityDevLogsTiny Barbarian!
Pages: [1] 2 3 4
Print
Author Topic: Tiny Barbarian!  (Read 18543 times)
sandcrab
Level 0
***


Buzzing!


View Profile WWW
« on: November 07, 2010, 02:17:20 PM »

Edit: 1/26/11
Tiny Barbarian ver 1.0 is now available for you!
Download Link



A while back I made some cool little sprites, obviously thinking they might make it into a game somehow, and then I decided well, why not do it myself with Game Maker!  So here it is, the current test environment for Tiny Barbarian!



My current plan for the game is to make one level, based loosely on the Conan the Barbarian short story "The Frost Giant's Daughter."  It's a short game based on a short story!  Mine already diverges heavily from the source material with the introduction of zombie vikings, but I did say "loosely."

Anyway, I have some limited programming experience but even Game Maker is still a challenge for me so I hit a lot of snags.  So what is the best etiquette here?  When I hit a snag that feels fairly general-purpose I don't have a problem posting to the GM Tutorials thread, but I'm at a point where I probably need someone to look at an entire enemy behavior script to get things fixed. (also providing some context for please-help-me code is a lot more fun and interesting..) Is that ok there, or should it be here, or should I just cast my hopes in desperation to the mercy of the official GM forums?

Anyway, thanks for checking it out!
« Last Edit: January 26, 2011, 11:11:19 AM by sandcrab » Logged

Nugsy
Level 10
*****



View Profile
« Reply #1 on: November 07, 2010, 02:37:30 PM »

Those sprites are hubba hubba.
Logged


Inanimate
Level 10
*****

☆HERO OF JUSTICE!☆


View Profile
« Reply #2 on: November 07, 2010, 02:39:52 PM »

I'm sure no one will object to you asking for help here, man! Especially with those sexy sprites.  Kiss
Logged
Doktor_Q
Level 2
**



View Profile
« Reply #3 on: November 07, 2010, 03:48:29 PM »

Dammit I feel so inadequate again.

Good job, I look forward to this.
Logged
J. R. Hill
Level 10
*****

hi


View Profile
« Reply #4 on: November 08, 2010, 01:22:47 AM »

FANTASTIC
Logged

hi
Scut Fabulous
Level 4
****



View Profile WWW
« Reply #5 on: November 08, 2010, 07:50:27 AM »



I want this wolf on a tshirt!
Logged

Aquin
Level 10
*****


Aquin is over here.


View Profile WWW
« Reply #6 on: November 08, 2010, 11:36:52 AM »

Damn this is one fine lookin' game!   Beer!
Logged

I'd write a devlog about my current game, but I'm too busy making it.
sandcrab
Level 0
***


Buzzing!


View Profile WWW
« Reply #7 on: November 08, 2010, 12:29:11 PM »

Thanks for the enthusiasm! :D  The wolf is the next enemy to go in, but I want to iron the bugs out of my existing enemies first so I don't end up fixing them all later.



I didn't get much done yesterday because I was mucking about trying to solve minor issues, but I added a life meter.  I used Game Maker's "Views" to make a second one, only sized to fit the life bar.  (Initially I just told it to follow the viewport around, but then it lagged behind it for some reason.)  If I had done a big view that extends all the way across the screen, it causes problems because there are tiles at the top pf the screen, and they would be drawn to the view and follow the screen just like the life meter did.  Also, if the barbarian gets up there, he follows the screen as well, instead of the screen following him!  So as long as there's nothing near touching the life bar's original position in the level, you'd never notice.  It would be really cool if the life meter could actually create the view, instead of me needing to recreate the view in the room editor for every room.  I'm sure there's a command for it, but I don't know it!



Currently my main problem is with characters dying.  The zombie viking in particular is supposed to shift modes to a dead-state (after which he may revive at random) after his death animation finishes.  It was working fine, but I added some code which allows some zombies to also be Archer Zombies, and then it just stopped working--the zombies would only switch modes if I told the mode to switch early in the animation instead of at the end, otherwise it just loops the animation forever and the state never switches.  I had saved the code from before, so I commented out all the new Archer lines and compared them, line-by-line, and couldn't find anything that was different enough to disrupt the sequence, so I have no idea what's wrong.

On a maybe-related note, the barbarian himself also loops his death animation, but only after he's been sitting there dead for about ten seconds (consistently, every time).  I didn't notice at first because I would revive him before the ten seconds were up, so I don't know if I did something later to change that or if it was always like it.

So, here's a link to the GMK file, if anyone wouldn't mind taking a look at it!

current - Zombies won't die/player has restless corpse
old - Zombies will die/player isn't programmed to die yet

Up next I'll be asking how to make it so the player (and other objects) can always consistently "stick" to the ground when they hit it, rather than snagging in the air above it and then falling again. :/
Logged

GZ
Level 1
*



View Profile WWW
« Reply #8 on: November 08, 2010, 04:14:35 PM »

*** Fixing the health bar:

Remove your second view from the room by checking "Visible when the room starts" to off.

Cut this code from the step event:

x = view_xview[1]+1
y = view_yview[1]+1

Change it to:

x = view_xview[0]+1
y = view_yview[0]+1

And paste it over (replace) this code in the draw event:

view_wview[1] = 1 + maxHealth*10;
view_wport[1] = 1 + maxHealth*10;

Now you are using one view and drawing the HUD. The error of lagging behind occurred because of the order GM handles events. You set the X and Y of the HUD in the step event, but the view changes after that because it's assigned in the room properties to follow the barbarian. The draw event executes later than that, so this way the HUD is always stuck on the view. This might sound confusing, because how would you possibly know the order of events like this, but this is only because you are using a GM system to handle your view rather than code. For instance, GM has begin step, step, end step, and draw. Usually you would handle the view in step and then assign the view coordinates to HUD objects and things like that in the end step. Speaking specifically of your game though, and using your current system, just make sure you set the coordinates for HUD objects in the draw event.

*** Fixing the barbarian loop:

The reason the death animation loops is because of how you have the image cycling system set-up. For starters, notice how oBarbarian uses the sBarbarian sprite. Notice how that sprite has 48 frames. Now notice how your image_speed is set to .2 when you die. That means every five steps, a new frame will appear. GM bases the image_index on the sprite assigned to the object, so your image_index will go from 0 to 48.999~ and loop back. So 5 steps per frame, and 48 frames, that equals 240 steps for that sprite to loop. Dividing 240 by 30 steps per second, that means every 8 seconds the barbarian will loop back to zero, creating the undesirable effect of him replaying the death animation.

The simple way to fix it is by replacing this code in the draw event:

if (image_index >= 4)
        frame = 3;
   
With this code:

if (image_index >= 4)
        {
        frame = 3;
        image_speed = 0;
        }
   
That way the barbarian will stop counting the image_index and never loop.

*** Fixing the skeleton:

Similar to the issue above. Look at the sprite for the skeleton in the old version and the new version. Notice how the old version uses sZombie, and obsolete sprite with 22 frames, and the new one uses zomStand which only has 4. Now, look at zomDie, and notice the frame count is 5. How can the zombie ever loop to the final frame if the sprite of the object is only 4 frames and the death animation is 5? Now, look at your code:

if (dying)
    {
    vspeed = 0;
    hspeed = 0;
    harmless = true;
    animName = zomDie;
    frame = -1;
    image_speed = .2;
    if (image_index >= 5)
        {
        animName = zomLive;
        image_index = 0;
        image_speed = 0;
        dead = true;
        dying = false;
        }
    }
    
Setting the sprite of the zombie to zomDie, a 5 frame object would seem to fix this problem. Try it, and you'll notice the zombie endlessly loops his death animation. Why? Because the number will never equal five, it will always be slightly less than that (ie. 4.999999). In your case, it's always 4.8 because you add by .2, so it would go 4.8, then 0. So you would need to change the sprite of the zombie to zomDie and then change this code:

if (image_index >= 5)

To:

if (image_index >= 4.8 )

This is not a good way to solve the problem though, and your animation system should work without needing a high frame count sprite to be the object sprite_index. So you may want to address this later on, unless you feel can get by with the current system.

Typically you want to change the actual sprite of the object (sprite_index) when using image_index so it loops the animations properly. So unless you use your own custom system that doesn't involve image_index, it's not advised to do animating unless you make sure the sprite of the object is in line with the animation you want to perform.
« Last Edit: November 08, 2010, 04:37:10 PM by GZ » Logged

cynicalsandel
Level 7
**



View Profile
« Reply #9 on: November 08, 2010, 04:33:40 PM »

From the screens you showed, I never would've expected that you were a newbie.

I'm especially jealous of that wolf sprite.
Logged

sandcrab
Level 0
***


Buzzing!


View Profile WWW
« Reply #10 on: November 10, 2010, 11:39:31 AM »

Quote
From the screens you showed, I never would've expected that you were a newbie.

Good art don't mean good code Smiley

@GZ - Thank you so much!  Sorry it took me a while to reply, every time I sat down to write "ok now I've tried this.." I ended up thinking of some other thing to try over and over.

I tried out your solutions and they all work, but as you say, it's probably not the best way to do things!  I tried switching the object's sprite, as you suggested, with sprite_index, but that introduces more problems, with animations that are supposed to end either not ending or looping incorrectly--I assume that has to do more with my logic than anything else, so I need a better understanding of what's actually happening.  Setting my commands that end the animations (if image_index >= 4 etc) to be slightly earlier (3.Cool does seem to work in most cases but it's also introduced other weird problems I didn't expect.

So is there a more recommended method for doing what I'm trying to do?  The reason the many-frame versions of the characters existed is because I thought I could set all the animations out of one sprite, and now that I think about it I'm going to give that another shot, but if you have any other suggestions I'd love to hear them!

Edit: I've changed things up!  Now I'm just using the long-sequence sprites (plus one redundant frame at the end), but thanks to your explanation of what I was actually doing I was able to get it working this time.  Now my animation-system look like this:


Quote
// calls Script: AnimAssign(name,startFrame,endFrame,loop,image_speed)
AnimAssign(1,0,1,true,.1);

...

//if new sequence, start from beginning of that sequence
if (animName != oldAnimName)
    image_index = startFrame;

//if at end of sequence, loop sequence
if (image_index >= endFrame+1)
    {
    if (loop)
        {
        image_index = startFrame;
        }
        else
            {
            image_speed = 0;
            animEnd = true;
            }
    }
   
draw_sprite_ext(sprite_index,-1,x,y,scale,1,0,col,opacity);
oldAnimName = animName;

Everything I was trying to do before should work a lot better with this!
« Last Edit: November 10, 2010, 01:02:26 PM by sandcrab » Logged

Fallsburg
Level 10
*****


Fear the CircleCat


View Profile
« Reply #11 on: November 10, 2010, 01:44:42 PM »

When I saw those sprites, I instantly thought of Conan and "The Frost Giant's Daughter.", so good job on that.
Logged
sandcrab
Level 0
***


Buzzing!


View Profile WWW
« Reply #12 on: November 11, 2010, 11:45:21 AM »



Zombies!  Now that my animation is in order I've added new zombie modes.  One is the Zombie Archer (or "Zarcher" as I like to call it), a wretched being whose only memory of his past life is ingrained deep in the muscles of the arm that holds his bow.  The other is the Ambush Zombie, or "Zambush," a poor creature who lives (or unlives?) under the shadow of a terrible naming scheme.
Logged

Aquanoctis
Level 6
*


View Profile WWW
« Reply #13 on: November 12, 2010, 04:31:47 PM »

Really great work with those sprites. Might just be me but the barbarian has a certain Original Prince of Persia feel about him.
Logged
moonmagic
Level 4
****



View Profile WWW
« Reply #14 on: November 13, 2010, 11:48:47 AM »

Your art is delightful! Love everything about this game; would like to play it.
Logged

|
BitShift
Guest
« Reply #15 on: November 15, 2010, 06:58:37 AM »

This game looks great.  Post a build!
Logged
Dom2D
Level 5
*****


I'll do it myself then!


View Profile WWW
« Reply #16 on: November 15, 2010, 11:44:38 AM »

Not only is the spritework great, but it's a sweet idea too, to take a Conan story and build a single level out of it, instead of you know, going for a full blown Metroidvania right away! I can't wait to play this.
Logged

sandcrab
Level 0
***


Buzzing!


View Profile WWW
« Reply #17 on: December 12, 2010, 10:23:35 AM »



Not a whole lot to show because I already showed the gist of most of my sprites, when I say "now the wolf is in" or "now the ice maiden is in" it's like great, I showed them in my first post!  So I've been quiet, but also a little discouraged because neither of them is working out exactly the way I wanted.

I also wanted to make use of a different level editor.  I don't think I'll meet much argument from anyone when I say that Game Maker's level editor is pretty awful.  A friend of mine has made a much, much better 2D editor, which we used for our recent team-up,

(I didn't do any programming on that one!), and he had an old GameMaker experiment laying around that could import levels from it.  I tried implementing it into TinyB, but it didn't work--I don't know if I'm doing it wrong or if he changed the level format since then, so this too was discouraging.

I mean seriously, the GM editor is a joke, and its support for tile masks is non-existent, so at least for that I built my own because I was sick of manually putting the masks over everything.  It was less straight-forward than I would think, because I figured tiles would have an ID that says which tile it is.  It turns out the tileID is assigned in the order it was placed in the level, which means every tile, even ones of the same type, have different IDs.  So what I had to do was look at every 16th x/y position (because my tiles are 16x16), get the ID of the tile that was on it (if there was a tile), and then ask the tile what its left side and top side coordinates in the original tile image I ripped them from was, and base it on that.  Talk about annoying!  Admittedly a unique ID could be very handy, but a "TypeID" would be very handy, too!

Anyway, getting that at least to work was immensely satisfying and then with my new-found tile knowledge I set about making certain tiles destroyable, and you'll be able to find gold or other treats (see third image above) inside them.  With the new tile destruction in I'm a lot more excited about the project again and I'm really looking forward to getting it all together.
Logged

thedaemon
Level 2
**



View Profile WWW
« Reply #18 on: December 12, 2010, 11:09:00 AM »

Sorry you've been frustrated. I'm not familiar with GM or I'd help, just another lowly artist here.
Logged
JasonPickering
Level 10
*****



View Profile WWW
« Reply #19 on: December 12, 2010, 01:06:46 PM »

Alright so a few things.

A. I fully support this project as a huge fan of Robert E. Howard and Conan.
B. I to know some of the sadness of using GM. I tried looking at your code, but I have switched to using Flashpunk and my brain dumped everything that had to do with GM and I was very lost.
C. I always thought about making a conan game myself (tower of the elephant) one idea I had was to make a short game like this. then make another level based on a different conan story. basically I planned to make maybe 5 or 6 "levels" and each one was a different story, and the player could choose which one to play. I would love to see this get fleshed out to other stories and levels.
D. can you post any video of it in motion?
Logged

Pages: [1] 2 3 4
Print
Jump to:  

Theme orange-lt created by panic