gravity/ and using a sword

Game Editor comments and discussion.

gravity/ and using a sword

Postby praaab » Thu Sep 22, 2011 7:19 pm

1. for gravity i use yvelocity + yvelocity = 2; it works and everything but when i get to the edge of a platform, he starts sliding away on the edge and eventually falls off. is there another code that I could use for the gravity script?

2. My character is a stick man with a sword and shield, when i want him to attack how do i make it so that if his sword hits an enemy then the enemy will die or get hurt depending on the hp level.

thanks,

Praaab.
praaab
 
Posts: 82
Joined: Sat Jun 18, 2011 2:14 pm
Score: 1 Give a positive score

Re: gravity/ and using a sword

Postby savvy » Thu Sep 22, 2011 7:42 pm

yvelocity + yvelocity = 2; for a start would set it to 2 all the time, use yvelocity+=2;
then ont he collision event with the top side of the ground use yvelocity=0;

then with the sword, add a collision with the enemy and use...
(this goes in the enemy, not player)
Code: Select all
if(collide.animindex==0||collide.animindex==1)
{
//0 being the animindex of the attack animation right, 1 left
hp-=1;
//hp is an actor variable
if(hp<=0)DIE;
}


maybe not well described, but ask away..

savvy
--> For my help, i ask for a simple +1 if it helps! ^-^
--> I dont code, I type art which you dont understand.
--> I keep winning the 3D model challenge at college, teacher says: "you keep winning im not giving you prizes".
User avatar
savvy
 
Posts: 494
Joined: Wed Jun 03, 2009 11:55 am
Location: England
Score: 44 Give a positive score

Re: gravity/ and using a sword

Postby praaab » Sun Oct 02, 2011 1:19 pm

ok well im new to this coding of C and im not sure where to put my animations in the lines of code that u gave me
praaab
 
Posts: 82
Joined: Sat Jun 18, 2011 2:14 pm
Score: 1 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest