Demo/Bug Fix - Need Help! .ged file included

Game Editor comments and discussion.

Demo/Bug Fix - Need Help! .ged file included

Postby BlenderFreak » Wed Jan 19, 2011 5:48 pm

Alright, experts (or non-experts who can solve my problems).
I've created a test file and I have an issue. I've looked through my codes over and over and over again trying to find out what's wrong with them, and haven't found any particular problems (though I haven't even *tried* to get the energy meter to work). For some reason the animation for the health bar doesn't work properly, and the character doesn't register hp loss. There are other things I want that I've tried multiple codes for that just don't seem to work, so I'm listing those as well. If anyone can take a look at my file and figure out what's wrong I'll be extremely grateful! Once I've got these bug fixes I'll be able to start working on the real game - I'll be able to use the codes in the PlayerTest.ged as an example for my work.
Here's what I want:
1. When the player collides with certain actors (in this test it's only a meteor), he will lose 1hp (I can change this later depending on the enemy, obviously). When hp reaches zero, it will play the explosion animation that I have set up, and at the end of that animation, the game will end (haven't made any special game over effects for that yet, but I will soon - it'll eventually enter the main menu or restart from the last save point). Whenever he loses a health point, however, I would like for the damaged sequence (1;6;) to play for two seconds. During those two seconds he should be unable to collide with enemies and obstacles - nor should he be able to fire bullets! I tried CreateTimer for that but it didn't work (don't have much experience with Timers apart from the DelayTimers in Python logic bricks). Since this is the playtest, I'm using it to represent the first level. In the first level your character will start out with only 5hp. You can collect pickups as you go about the levels in order to upgrade your ship and increase its hp.
2. Ammunition... I think I deleted the bullet actor, but I was having so much trouble with ammunition that I just gave up on it. There should be about a 1 second delay between bullet fires, and each bullet fire should subtract 1ep (Energy Points) from the Energy Meter (the blue bar beside the HP). Had *so* much trouble and frustration with this.
3. If someone could let me know how to do this... I tried over and over, but I think my problem with this is stemming from my problems with hp in general).
Since "hp" is basically "upgrading" the Prototype, this means that your character's ship should *visibly* upgrade. So I created multiple different sprites - one for each upgrade. If someone can tell me how to change the frame of the animation based on the hp, that would be very helpful. I'd like to accomplish this.

That's three things... hope I was detailed enough. Anyway, let me know if you have a solution and post the fixed .ged file! Thanks, guys! Hope you like my graphics, too! :D
PrototypeBugFix.zip
This is the Prototype Demo/Bug Fix. Feel free to use my graphics, but give credit where it is due!
(1.44 MiB) Downloaded 90 times
There's not much there yet, but you can find information on my current projects here.

https://sites.google.com/site/darkst3am/
User avatar
BlenderFreak
 
Posts: 55
Joined: Sun Sep 26, 2010 5:46 am
Location: His Computer
Score: 2 Give a positive score

Re: Demo/Bug Fix - Need Help! .ged file included

Postby skydereign » Thu Jan 20, 2011 1:22 am

Okay, first of all, I would flip your hp bar horizontally. The bar should increase as animpos increases, that way hp and animpos can be equal. Second, that is why you are having problems. You are trying to decrease animpos as hp decreases, with your current setup you should increase animpos. Lastly, if you have an event, like CreateActor, you should only use one resulting event, script editor. Currently for your hp bar actor, you have to create actor events. One as script editor, the other as ChangeAnimationDirection. Instead you could use one create actor event like this.
Hp_Bar -> Create Actor -> Script Editor
Code: Select all
hp=5;
ChangeAnimationDirection("Event Actor", "STOPPED");


It makes it easier to read through your game, and easier for you to change things.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Demo/Bug Fix - Need Help! .ged file included

Postby Toasterman » Thu Jan 20, 2011 7:41 pm

If you do what Sky said, your HP and ammo problems will probably be cleared up-

To keep from getting hit while in damage sequence, I can think of several ways to do this (i think they would work,anyway)
1) make a variable ( can_collide, CC, something like that?) that is turned to 0 when hit. Then, any time the char gets hit, checks if var==1 before getting hurt:
create actor event- CC=1;
collide event- if(CC==1){ Player.HP-=1; CC=0; (start a two second timer); };
timer event- CC=1; destroy timer;
2) after getting hit, just disable collisions for that actor for two seconds
3) if you have an animation for "hurt" or whatever, then check if that animation is playing
collide event- if(P.animindex==4 (or whatever position that animation is) ){ do nothing }
else { Player.HP-=1; (change animation to damaged / hurt) etc; etc; };

to change the from of the animation based on HP, something like this maybe:
if(HP==1){ animpos=0; };
if(HP==2){ animpos=1; };
if(HP==3){ animpos=2; };
etc; etc.


Maybe some of this will help?
"If there are no stupid questions, what kind of questions do stupid people ask? Do they get smart just in time to ask a question? -Scott Adams

Hey! I've got okayish internet now! Now I can try all those cool demos I've seen!
User avatar
Toasterman
 
Posts: 75
Joined: Thu Jul 22, 2010 4:22 am
Location: Drowning in Dial-Up Ocean
Score: 7 Give a positive score

Re: Demo/Bug Fix - Need Help! .ged file included

Postby BlenderFreak » Fri Jan 21, 2011 1:43 am

Thanks guys - I got all of that fixed! Thanks a lot!
Now I have a different problem that I've discovered.
I use a "Animation Finish" activator for the "Main_Explosion" animation, which occurs when the character's hp reaches 0 (or below). The animation starts when hp becomes zero, and collisions cease, but the animation only plays the first frame. When I chose "Change Animation" in the script editor, I made certain to set it at "FORWARD", so I'm not sure what's wrong. Any idea how to play the animation?
There's not much there yet, but you can find information on my current projects here.

https://sites.google.com/site/darkst3am/
User avatar
BlenderFreak
 
Posts: 55
Joined: Sun Sep 26, 2010 5:46 am
Location: His Computer
Score: 2 Give a positive score

Re: Demo/Bug Fix - Need Help! .ged file included

Postby DST » Fri Jan 21, 2011 3:09 am

Make sure not to repeat the event. If it's a draw actor> health<0, and health stays at 0....it will retrigger the changeanimation over and over and over.
throw some other variable in....

if(health<0 && wasplayed==0){
ChangeAnimation();
wasplayed=1;}

or something similar. there are lots of ways to do this, but the only animation triggers that are ok to use repeatedly are STOPPED and NO_CHANGE.
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: Demo/Bug Fix - Need Help! .ged file included

Postby BlenderFreak » Sun Jan 23, 2011 9:56 pm

Hmmm alright, I think I understand - I'll have to try it out. Thanks, DST!
There's not much there yet, but you can find information on my current projects here.

https://sites.google.com/site/darkst3am/
User avatar
BlenderFreak
 
Posts: 55
Joined: Sun Sep 26, 2010 5:46 am
Location: His Computer
Score: 2 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest