help with shooting directions

Game Editor comments and discussion.

help with shooting directions

Postby jimmynewguy » Tue Jun 19, 2007 2:04 am

i used this code
Code: Select all
if (animindex == getAnimIndex("guy walk r") ||
    animindex == getAnimIndex("guy stop"));
{
  CreateActor("bullet", "BULLET", "(none)", "bullet r ", 25, 0, false);
}

else CreateActor("bullet", "BULLET", "(none)", "bullet l  ", 0, 0, false);


so bullets would shoot the way the character was facing but an error ocured (bad spelling :oops: ) does any one no what i did wrong?
User avatar
jimmynewguy
 
Posts: 1137
Joined: Sat Mar 31, 2007 6:27 pm
Score: 89 Give a positive score

Re: help with shooting directions

Postby Sgt. Sparky » Tue Jun 19, 2007 5:29 am

jimmynewguy wrote:i used this code
Code: Select all
if (animindex == getAnimIndex("guy walk r") ||
    animindex == getAnimIndex("guy stop"));
{
  CreateActor("bullet", "BULLET", "(none)", "bullet r ", 25, 0, false);
}

else CreateActor("bullet", "BULLET", "(none)", "bullet l  ", 0, 0, false);


so bullets would shoot the way the character was facing but an error ocured (bad spelling :oops: ) does any one no what i did wrong?

I reccomend not using Spaces in a file name, it is easy to mess up with that(I mess up all the time! :( )
but look at my gun equiping/shooting Demo here:
http://game-editor.com/forum/tp-3623-Gu ... mple-.html
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Postby jimmynewguy » Tue Jun 19, 2007 2:09 pm

i downloaded the game but an error occurd :evil: , could u write me a script instead,plz? :?
thanks for the help sparky!! :D 8) :D :lol: :o :D 8)

PS: reallllllllllllllllllllly srry for the trouble :(
User avatar
jimmynewguy
 
Posts: 1137
Joined: Sat Mar 31, 2007 6:27 pm
Score: 89 Give a positive score

Postby jimmynewguy » Tue Jun 19, 2007 3:47 pm

nvm i fixed it :P but came up with a new problem :roll:
i want the enemy to face my character so i used this code under draw actor
Code: Select all
int d = direction(xscreen, yscreen, player.xscreen, player.yscreen);
if ( d <= 251 && d > -36 )
  animpos = 1;
else if ( d <= 360 && d > -36 )
  animpos = 2;

it works but the problem is the enemy still follows his regular animation so every second or two he'll turn the other direction and glith up :shock: , any ideas? :?:
User avatar
jimmynewguy
 
Posts: 1137
Joined: Sat Mar 31, 2007 6:27 pm
Score: 89 Give a positive score

Postby pixelpoop » Tue Jun 19, 2007 3:54 pm

on a create actor event of the enemy, put a change animation direction -stop
User avatar
pixelpoop
 
Posts: 276
Joined: Tue Aug 29, 2006 9:32 pm
Score: 28 Give a positive score

Postby jimmynewguy » Tue Jun 19, 2007 4:17 pm

oh thanx
points ++
User avatar
jimmynewguy
 
Posts: 1137
Joined: Sat Mar 31, 2007 6:27 pm
Score: 89 Give a positive score

Postby jimmynewguy » Tue Jun 19, 2007 4:42 pm

wait now he doesnt turn around if im 2 the left of him but he will on the right im so confused!!
User avatar
jimmynewguy
 
Posts: 1137
Joined: Sat Mar 31, 2007 6:27 pm
Score: 89 Give a positive score

Postby Sgt. Sparky » Tue Jun 19, 2007 6:32 pm

Code: Select all
int d = direction(xscreen, yscreen, player.xscreen, player.yscreen);
if ( d <= 251 && d > -36 )
  animpos = 1;
else if ( d <= 360 && d > -36 )
  animpos = 2;

why do you use "if d > -36"?
d will only be set from 0 to 359,
try canging your code to:
Code: Select all
if(player.x < x)animpos = 0;
if(player.x >= x)animpos = 1;

:D
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Postby jimmynewguy » Tue Jun 19, 2007 7:29 pm

idk y im not smart @ scripting but thx sparky
(ur too smart to be near me :cry:)
User avatar
jimmynewguy
 
Posts: 1137
Joined: Sat Mar 31, 2007 6:27 pm
Score: 89 Give a positive score

Postby Sgt. Sparky » Wed Jun 20, 2007 11:40 pm

you are welcome. :D
*is sad because you walked away* :(
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest