A few weeks ago I had no clue where to even start with C++ programming and Game-Editor, but Phyziks short series of tutorials (there's only like 4 of them) REALLY helped me try to wrap my mind around some of the basic concepts of coding.
viewtopic.php?f=27&t=11867And this tutorial by Skydereign was extremely helpful for easing me into the concept of complex actions. I had to reread it a few times but now I have a perfect understanding of it, and can make some relatively complex code!
http://game-editor.com/SwitchIf you wanna learn what most of the major functions in GE are, here's a good place to look:
http://game-editor.com/docs/script_reference.htmAlso if you wanna learn what some of the REALLY basic functions are, here's a good simple list:
viewtopic.php?f=27&t=12246and another:
http://game-editor.com/Variablesskydereign wrote:Fighting moves should work like everything else in gE. The only difference is that the actors involved interact via collisions (or similar). That being said, when you change the actor's animation to an attack animation, you'll want to set some variable to signify it is attacking. That way in the collision event, you can tell if the actor is actually attacking, instead of just colliding with a stand animation.
So basically what he's getting at is you would want to create a variable and name it something, anything you want, in this case we'd name it "attack".
To create your own variable (which is covered in Phyziks tutorial), go to Script>Global Code, and type:
- Code: Select all
int attack;
And then type the name at the bottom and press Add.
Pretty simple, now you will want to follow the Switch tutorial I posted, and feel free to reread parts of it until you feel like you fully understand the concept. Believe me, it definitely took me a few tries.
After you've added the Switch(state) cases for all of your players animations/movements, create two cases for state. One for attacking left, and the other for right. Now just have it so if you press the attack button, and state=0, (standing right) or running right (state=2), then you attack facing right. (state=6???) and etc. for the left facing attack. This way, if you want, you can create another attack specifically for when you are jumping. Now that
int attack you did earlier comes into use now. Before you put
Break;, set attack to 1. It
MIGHT look a little something like this:
KeyDown>(Attack Button)(REPEAT DISABLED)>Script Editor:
- Code: Select all
switch(state)
{
case 0: //if you are facing right
case 2: //or running right
ChangeAnimation("Event Actor", "Goomba_Right_Attack", FORWARD); //change animation to your attack
attack=1; //change the attack variable from 0 to 1
state=6; //set state to 6, which in this situation means your player is attacking to the right
break; //execute the code
}
and then on your KeyUp>(Attack Button)>Script Editor:
- Code: Select all
switch(state)
{
case 6: //if you are attacking to the right
ChangeAnimation("Event Actor", "goomba_right_idle", NO_CHANGE); //change to the idle animation
state=0; //change your state back to standing facing right
attack=0; //set attack to 0, which means you're not attacking
break; //execute the code
}
and lastly, make a collision event with the enemy you're attacking; if attack=1 and you're colliding with the enemy, the enemy will lose health (you can do this by giving the enemy a variable for health, like "int enemyhealth", setting enemyhealth to a number, like 100, and then subtract from it, like subtract 25 everytime you hit the enemy, and if enemyhealth<=0, destroyActor.
I
really hope this helped lead you in the right direction. I know firsthand how frustrating it is having the passion for game-design but no-one around to help you, so I'll gladly try to teach you what little I know whenever possible. Good luck!