Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/06/23 11:29
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
7 registered members (fairtrader, Quad, miwok, Martin_HH, AndrewAMD, alibaba, dpn), 581 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
enemy health #373228
06/08/11 15:23
06/08/11 15:23
Joined: Dec 2009
Posts: 361
R
rtsgamer706 Offline OP
Senior Member
rtsgamer706  Offline OP
Senior Member
R

Joined: Dec 2009
Posts: 361
I am a programmer working with the free version of A8
I am making a shooting game and i have an issue.
Thanks to a recent post my bullet collisions are working properly now.
I would like it to take 3 shots to kill each enemy, so I created a variable as you can see below.
the problem is that the collision is according to my bullet, so if I say:
hp - 1;
I will get an error because it doesn't know what hp is.
I can't make the variable global either because then all enemies will die when hp = 0
here is the relevant part of my code:
Code:
function deal_dmg()
{
	if(event_type = EVENT_ENTITY)`
	{
		wait(1);
		ent_remove (me);
		if (you.skill57)
		{
		wait(1);
		ent_remove (you);
		}
	}
}

action shot()
{
	c_setminmax(me);
	my.pan = guy.pan;
	var durability = 85;
	my.emask |= (ENABLE_ENTITY);
	my.event = deal_dmg;
	while(my)
	{
		c_move (me, vector(0, 25*time_step, 0), nullvector, IGNORE_PASSABLE); // move the bullet forward
		durability -= 1;
		if(durability <= 1)
		{
			wait(1);
			ent_remove (me);
		}
		wait(1);
	}
}

action enemy()
{
	var hp = 3;
	my.pan -= 90;
	c_setminmax(me);
	my.skill57 = 1;
	my.emask |= (ENABLE_ENTITY);
}



Thanks for the help and sorry for the complicated post.
Rtsgamer706

Re: enemy health [Re: rtsgamer706] #373229
06/08/11 15:27
06/08/11 15:27
Joined: Nov 2008
Posts: 946
T
the_clown Offline
User
the_clown  Offline
User
T

Joined: Nov 2008
Posts: 946
Make it a skill.

Re: enemy health [Re: the_clown] #373272
06/08/11 20:59
06/08/11 20:59
Joined: Dec 2009
Posts: 361
R
rtsgamer706 Offline OP
Senior Member
rtsgamer706  Offline OP
Senior Member
R

Joined: Dec 2009
Posts: 361
how do I do that?
Sorry, I have no idea what that means...

Re: enemy health [Re: rtsgamer706] #373274
06/08/11 21:10
06/08/11 21:10
Joined: Jan 2011
Posts: 122
GUILIN , CHINA
tzw Offline
Member
tzw  Offline
Member

Joined: Jan 2011
Posts: 122
GUILIN , CHINA
use a skill to store hp that global can access it
#define hp skill2
....
you.hp-=5;


Full of my eyes are class struggles.....
Re: enemy health [Re: tzw] #373307
06/09/11 12:19
06/09/11 12:19
Joined: Dec 2009
Posts: 361
R
rtsgamer706 Offline OP
Senior Member
rtsgamer706  Offline OP
Senior Member
R

Joined: Dec 2009
Posts: 361
Wow, works perfectly now
and I now know how to use skills (a little)
Thanks a ton!


Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1