Page 1 of 2

shooting

PostPosted: Thu Mar 22, 2012 6:59 pm
by yourownskills
I made a bullet actor and made a player actor and put it in the KEYDOWN input... I got it to work but when I hold the button down it streams the bullet..Im using the Create Actor in the Keydown. My skype is

snake85027@yahoo.com

Re: shooting

PostPosted: Thu Mar 22, 2012 7:01 pm
by Game A Gogo
When creating the keydown event, make sure that Repeat is set to no

Re: shooting

PostPosted: Thu Mar 22, 2012 7:18 pm
by yourownskills
oooh maaaaaaaaaaan, thanks for that... I could have swore I had that disabled. Thats what happens when you sit at the computer to long.

Re: shooting

PostPosted: Thu Mar 22, 2012 7:47 pm
by yourownskills
Image


So right now I got the jump working and all that....But I cant just keep on going up if I keep in clicking the spacebar so it looks like im flying. How can I prevent that from happening?


yvelocity = -8;


thats my code for KeyDown

Re: shooting

PostPosted: Thu Mar 22, 2012 7:56 pm
by Hblade
http://www.youtube.com/playlist?list=PL1F157AEB67C6265E

You can learn more about collision there :) Advanced Collision even :D

Of course my methods aren't as pro as others but they work :)

Also episode 2 will help you with your jumping bug.

Re: shooting

PostPosted: Fri Mar 23, 2012 5:25 am
by yourownskills

Re: shooting

PostPosted: Fri Mar 23, 2012 5:32 am
by Hblade
make sure repeat is off, and watch this vid, it shows you how to jump:


http://www.youtube.com/watch?v=XEnNFrMb72o

Re: shooting

PostPosted: Fri Mar 23, 2012 6:57 pm
by yourownskills
So I got everything working...but for some odd reason I cant jump again if Im on this fence collision. Any ideas.

Re: shooting

PostPosted: Fri Mar 23, 2012 8:18 pm
by yourownskills
never mind figured it out...had to put a jump scripted in the player for the tree collider.

Re: shooting

PostPosted: Sat Mar 24, 2012 1:15 am
by yourownskills
i cant find something on double jump

Re: shooting

PostPosted: Sat Mar 24, 2012 5:04 am
by yourownskills
I have a question about HP and how to set it up..

I have my 3 different pngs that I want to represent the 3 different stages of being hit.... I dont know what to do next...any advice would be greatful. Im just an artist, not a programmer.

Re: shooting

PostPosted: Sat Mar 24, 2012 9:02 am
by skydereign
I assume you mean how to make the hp bar display (opposed to the player having different animations). To do that create a single animation for your hp bar actor. The first frame should represent 0 hp, the next one would be 1, and so on. In your case that means 0 hearts, 1 heart, 2 hearts, and 3 hearts. You also will need to create an hp variable. Set it to 3 when you want to initialize the hp (player's create actor for instance) then each time the player gets hurt reduce it by 1. And for your actual hp display actor, in its create set its animation direction to stopped (so it doesn't cycle through the animation). Lastly to display, you can use this.
Code: Select all
animpos=hp_var;

animpos is the frame that the animation is on. You'll notice if you made the animation correctly, when hp=0 the frame is 0 (with 0 hearts) and so on.

Re: shooting

PostPosted: Sat Mar 24, 2012 9:18 am
by yourownskills
thanks, ive been up forever trying to figure out the best way to animate his attacks....

im no programmer, I just started using this a few days ago. im having problems with seeing the entire attack animation... I select key down and pick my attack animation..when i go to test it..its to fast and doesnt finish because i release the button that im using for the attack... so it may play 2 frames out of five. how can i get it to play the entire attack animation even though i let go of the attack button?

Re: shooting

PostPosted: Sat Mar 24, 2012 9:23 am
by skydereign
Releasing the key doesn't by default change the animation back to the other one. That must be something you added. So, the way you would do it is have the keydown (no repeat) change the animation to your attack animation. Then, on the animation finish event for the attack animation, you'll probably want to reset it back to the player's normal animation, so do so in that event.

Re: shooting

PostPosted: Sat Mar 24, 2012 10:35 am
by yourownskills
im trying to get my character to attack facing right as well as attacking when facing left..and while jumping...
i did ADD EVENTS key Down...change animation


I followed a tutorial on youtube for the bottom code, i dont really understand it. Im a graphics guy. So I tried adding the attack animations differently from what i learned in a different tutorial.

this is in my Player--Draw Actor.....so i can move left and right and jump

char *key=GetKeyState();
int dir=key[KEY_RIGHT]-key[KEY_LEFT];
int j=key[KEY_SPACE];
switch(dir)
{
case 0: //none or both
if(animindex==0)
{
ChangeAnimation("Event Actor", "charStopLeft", NO_CHANGE);
}
else if(animindex==1)
{
ChangeAnimation("Event Actor", "charStopRight", NO_CHANGE);
}


break;

case -1: //Left
Collider. x-=5;
ChangeAnimation("Event Actor", "charLeft", NO_CHANGE);
break;

case 1: //Right
Collider. x+=5;
ChangeAnimation("Event Actor", "charRight", NO_CHANGE);
break;
}

if(Collider.yvelocity<10)
Collider.yvelocity+=.5;

switch(j)
{
case 0:
break;
case 1:
if(!jump)
{
Collider.yvelocity=-10;
jump=1;

}
break;
}