Page 1 of 2

enemy shooting

PostPosted: Sat May 19, 2007 8:39 am
by dimster
ok, i have had a few problems with my game, but i have finaly almost finished it. i am on the last level, the "boss" level and i am having trouble making him shoot towards the player. i havent made my character able to shoot yet either but i think i understand how to do that. but i dont know how to make the enemy shoot towards the character every 3 seconds.

help would be greatly appreciated

Re: enemy shooting

PostPosted: Sat May 19, 2007 9:10 am
by Tytan McAnguns-PL
In enemy shot create actor event .

code wrote:angle = direction(x, y, player.x, player.y);
directional_velocity = 10;

PostPosted: Sat May 19, 2007 11:39 am
by dimster
k thnx, i sorted all that out now. im trying to make lives now.

PostPosted: Sat May 19, 2007 12:14 pm
by Tytan McAnguns-PL
In global code , create the "life" varible type and in
create player actor event "life = 100"
And in the draw actor this :

if(health <= 0)
{
DestroyActor("Event Actor");
}

PostPosted: Sat May 19, 2007 1:10 pm
by dimster
kk thnx, ill have a go at that. im pretty new to the software and this is my first game so im still learning the scripts. 8)

PostPosted: Sat May 19, 2007 2:17 pm
by dimster
ok, ive put
Code: Select all
if(life <= 0)
{
DestroyActor("THEBOSS");
}


and put it on the draw actor for "THEBOSS"

and when i reach the level the boss is already destroyed, what have i done wrong?

PostPosted: Sat May 19, 2007 3:17 pm
by d-soldier
in the boss's create actor event did you set his life? Typically this happens when no life is set. Be sure you have a create-actor script that says:
life=100;

or whatever amount you want.. Any make sure that your "life" variable is an actor variable, not global.

PostPosted: Sat May 19, 2007 3:37 pm
by dimster
oh kk... i created him on collision with another actor that takes you to that level, ill try creating him from script instead.

PostPosted: Sat May 19, 2007 3:41 pm
by dimster
ok i tried that and put:
Code: Select all
CreateActor("THEBOSS", "wizzyboss", "(none)", "BOSS'path", 2700, 445, true);
(life = +100);
if(life <= 0);
{
DestroyActor("THEBOSS");
}



but it hasnt worked... what else do i need to add?

PostPosted: Sat May 19, 2007 3:51 pm
by d-soldier
Not like that... Your boss actor is always there right? (wherever he is in your level)? Or does something create him at a certain point? In his actor control, click add event, select "create actor", then "script editor". You should be looking at a blank script. Assuming from the previous messages that "life" is your health variable (set to actor variable instead of global) you would have the following script:

life=100;

remove all that junk from the draw actor script except for:

if ( life <= 0 )
DestroyActor("Event Actor");

The easy way to think of it is that GE check the create actor events only once, when the actor is created... this is where you would place starting information. The draw actor scripts are constantly checked by GE to update the game during play. Use the above scripts in the correct places, and repost with any problems / the answer to my initial questions.

PostPosted: Sat May 19, 2007 3:56 pm
by dimster
well the boss is only seen on the last level and is on a continuous path, it can be created at anytime aslong as its still there when you reach level 10.

(as you can tell im a script vergin when it comes to GE)

anyway ill try that out now and tell you how it goes

PostPosted: Sat May 19, 2007 3:58 pm
by d-soldier
Be sure to follow those directions exactly, and if you still have problems, upload the ged/source files and I'll take a look for you and get your squared away.

PostPosted: Sat May 19, 2007 4:14 pm
by dimster
hmmm still doesnt work... heres the zip (it should everything in it you will need)

PostPosted: Sat May 19, 2007 4:40 pm
by d-soldier
... First let me say, cool game man. Did you make all the graphics youtself? Pretty cool little game here...
Okay, so here's what I did to get it working... exactly what I said above. I dont know if you didn't save it after trying the scripts I gave you, but nothing was setup as I said it needed to be. The life variable was still global, there was no create actor script for theboss, and the draw actor script still had all that junk in it.
1) Click on on the SCRIPTS tab in GE, click GLOBAL CODE, the VARIABLES, EDIT / LIFE, switch from global to actor.
2) Click on THEBOSS (be sure it doesn't accidently click the fireball below him as i did a few times) and bring up the actor controls. Click "add event" / "create actor" / "Script Editor". In that blank script use:

life=100;

then click OKAY / IMMEDIATE ACTION

3)Click on EDIT EVENT / DRAW ACTOR / SCRIPT EDITOR
and remove eveything from the script, and paste in:

if ( life <= 0 )
DestroyActor("Event Actor");

then click OKAY / IMMEDIATE ACTION

---
Thats it, I'm watching the wizard running all around the screen shooting fireballs at me right now. And dont worry about not being good with the scripting, I was asking the same questions just a month ago, and getting frustrated when people would answer without being speciffic enough to really help me due to my limited understanding. Let me know how this works out.

PostPosted: Sat May 19, 2007 4:53 pm
by Kodo
Got lots of errors on trying to load your game, some were sorted out by renaming your data directory back to 'data', then I got an error about a missing font, which I copied over the one in the data directory from my windows fonts directory, then I started getting different missing art errors so I gave up, too much hassle :(