Diffrent Event from Same Key

You must understand the Game Editor concepts, before post here.

Re: Diffrent Event from Same Key

Postby GuybrushThreepwood » Mon Jan 26, 2009 1:39 am

Ok. My game is a side scrolling game. As for directions, you use the arrows to move left and right. to attack just turn the direction you want to attack and attack. :mrgreen:
Pirate: You fight like a diary farmer!
Guybrush: How appropriate, you fight like a cow!
User avatar
GuybrushThreepwood
 
Posts: 89
Joined: Sun Jul 06, 2008 12:23 pm
Location: Melee Island
Score: 1 Give a positive score

Re: Diffrent Event from Same Key

Postby GuybrushThreepwood » Mon Jan 26, 2009 1:40 am

Ok. My game is a side scrolling game. As for directions, you use the arrows to move left and right. to attack just turn the direction you want to attack and attack. and i dont have a direction variable. :mrgreen:
Pirate: You fight like a diary farmer!
Guybrush: How appropriate, you fight like a cow!
User avatar
GuybrushThreepwood
 
Posts: 89
Joined: Sun Jul 06, 2008 12:23 pm
Location: Melee Island
Score: 1 Give a positive score

Re: Diffrent Event from Same Key

Postby skydereign » Mon Jan 26, 2009 2:16 am

Two posts? Okay, so you mean that when you attack left you press, LEFT and ATTACK. And for right, RIGHT and ATTACK? Or when you are facing right, you attack right, and when you are facing left you attack left?
User avatar
skydereign
 
Posts: 3461
Joined: Mon Jul 28, 2008 8:29 am
Score: 570 Give a positive score

Re: Diffrent Event from Same Key

Postby GuybrushThreepwood » Mon Jan 26, 2009 2:33 am

when you're facing right you attack right and when facing left you attack left. it's a lot like super smash bros. :mrgreen:
Pirate: You fight like a diary farmer!
Guybrush: How appropriate, you fight like a cow!
User avatar
GuybrushThreepwood
 
Posts: 89
Joined: Sun Jul 06, 2008 12:23 pm
Location: Melee Island
Score: 1 Give a positive score

Re: Diffrent Event from Same Key

Postby skydereign » Mon Jan 26, 2009 3:18 am

How did you set up the directional attacking? You said you didn't use a variable. You should use the method in the demo and apply it to your working system.
User avatar
skydereign
 
Posts: 3461
Joined: Mon Jul 28, 2008 8:29 am
Score: 570 Give a positive score

Re: Diffrent Event from Same Key

Postby GuybrushThreepwood » Mon Jan 26, 2009 4:01 am

the attacking is what i need to figure out how to do. as for moving, i dont use scripting i just use different key down events :mrgreen:
Pirate: You fight like a diary farmer!
Guybrush: How appropriate, you fight like a cow!
User avatar
GuybrushThreepwood
 
Posts: 89
Joined: Sun Jul 06, 2008 12:23 pm
Location: Melee Island
Score: 1 Give a positive score

Re: Diffrent Event from Same Key

Postby skydereign » Mon Jan 26, 2009 4:09 am

What I meant was how do you differentiate the attacks, left and right. Do you have a working separate attacks for each? Or is that the part that you need help with?
User avatar
skydereign
 
Posts: 3461
Joined: Mon Jul 28, 2008 8:29 am
Score: 570 Give a positive score

Re: Diffrent Event from Same Key

Postby GuybrushThreepwood » Mon Jan 26, 2009 6:20 am

the diffrent attacks are just when he has his sword and when he doesn't have his sword. just one attack for each. it's just getting it on left or right. :mrgreen:
Pirate: You fight like a diary farmer!
Guybrush: How appropriate, you fight like a cow!
User avatar
GuybrushThreepwood
 
Posts: 89
Joined: Sun Jul 06, 2008 12:23 pm
Location: Melee Island
Score: 1 Give a positive score

Re: Diffrent Event from Same Key

Postby skydereign » Mon Jan 26, 2009 6:24 am

Okay, so then you need to create a variable called direction. On pressing right, set the variable to 1, and when pressing left, set it to -1. Then in the attack script set an if statement for direction==1 and direction==-1. For the direction==-1, change the animation to the left animations.
User avatar
skydereign
 
Posts: 3461
Joined: Mon Jul 28, 2008 8:29 am
Score: 570 Give a positive score

Re: Diffrent Event from Same Key

Postby GuybrushThreepwood » Mon Jan 26, 2009 8:00 am

as i have mentioned many times before i dont have a clue about scripting so i have no idea where to put any of this and what to do with it. sorry abot asking so much, but could you make me a demo? it would help a lot :mrgreen:
Pirate: You fight like a diary farmer!
Guybrush: How appropriate, you fight like a cow!
User avatar
GuybrushThreepwood
 
Posts: 89
Joined: Sun Jul 06, 2008 12:23 pm
Location: Melee Island
Score: 1 Give a positive score

Re: Diffrent Event from Same Key

Postby skydereign » Tue Jan 27, 2009 1:03 am

Here, I changed the sprites because I did not want to reflect horizontally framed sprites. You should really learn scripting, it will benefit you greatly, and it is pretty easy with all the help on the forums. By the way, this is very poor scripting, I am busy right now so I did not spend much time on it. Also, I forgot to add hit2_l sprite, but it defaults anyways.
Attachments
combos5.zip
(187.96 KiB) Downloaded 86 times
User avatar
skydereign
 
Posts: 3461
Joined: Mon Jul 28, 2008 8:29 am
Score: 570 Give a positive score

Re: Diffrent Event from Same Key

Postby GuybrushThreepwood » Tue Feb 03, 2009 7:35 am

Thanks a million :mrgreen: +1



EDIT:
I just have 1 quik question. i'v got an animation for wen my guy takes out, and puts away his sword. how wud i go about doing this? i gotta figure it out one o theese days, so DON'T GIVE ME A DEMO! just give me the gist of it. :mrgreen:
Pirate: You fight like a diary farmer!
Guybrush: How appropriate, you fight like a cow!
User avatar
GuybrushThreepwood
 
Posts: 89
Joined: Sun Jul 06, 2008 12:23 pm
Location: Melee Island
Score: 1 Give a positive score

Re: Diffrent Event from Same Key

Postby skydereign » Tue Feb 03, 2009 8:02 am

Put the animation change in the KeyDown(SPACE) event and I believe flip the ready to 0. Also, everything in the KeyDown(SPACE) event should be enclosed in an if statement
Code: Select all
if (ready==1)
{
   //put code here
}

I believe that is all. If not, let me know, or if you would like a better explanation.
User avatar
skydereign
 
Posts: 3461
Joined: Mon Jul 28, 2008 8:29 am
Score: 570 Give a positive score

Re: Diffrent Event from Same Key

Postby GuybrushThreepwood » Sat Feb 07, 2009 10:09 pm

I think i'm gunna take up on ur offer. a better explination would be nice :mrgreen:
Pirate: You fight like a diary farmer!
Guybrush: How appropriate, you fight like a cow!
User avatar
GuybrushThreepwood
 
Posts: 89
Joined: Sun Jul 06, 2008 12:23 pm
Location: Melee Island
Score: 1 Give a positive score

Re: Diffrent Event from Same Key

Postby skydereign » Sat Feb 07, 2009 11:30 pm

Okay. In this demo, I use several variables, one being ready. I use ready to signify the ability for the actor to do an event. So for every event that would change the animation, I set the variable ready to 0.
Actor->KeyDown(SPACE)->Script Editor // This is what is there
Code: Select all
if (sword==0)
{
   sword=1;
   ChangeAnimation("Event Actor", "standsword", FORWARD);
}
if (sword==1)
{
   sword=0;
   ChangeAnimation("Event Actor", "stand", FORWARD);
}


Now, you want it to change animation, so you the animation to the desired one. And to prevent an attack before the animation finishes, you need to set ready to 0. But to pull out your sword, you must be ready to recieve an action, so you would use a conditional to create this effect.

Code: Select all
if (ready==1)
{
if (sword==0)
{
   sword=1;
   ready=0;
   ChangeAnimation("Event Actor", "swordanim", FORWARD);
}
if (sword==1)
{
   sword=0;
   ready=0;
   ChangeAnimation("Event Actor", "standanim", FORWARD);
}
}

There is an event already on the actor's animation finish, that resets ready to 1. Now you could either use variables to do the next part or just use the animationfinish event.
Actor->AnimationFinish(swordanim)-> Set it to change animation to standsword
and another one
Actor->AnimationFinish(standanim)-> Set it to change animation to stand
Last edited by skydereign on Sun Feb 08, 2009 2:21 am, edited 1 time in total.
User avatar
skydereign
 
Posts: 3461
Joined: Mon Jul 28, 2008 8:29 am
Score: 570 Give a positive score

PreviousNext

Return to Advanced Topics

Who is online

Users browsing this forum: No registered users and 0 guests