Gamestudio Links
Zorro Links
Newest Posts
Lapsa's very own thread
by Lapsa. 06/26/24 12:45
Executing Trades on Next Bar Open
by Zheka. 06/20/24 14:26
A simple game ...
by VoroneTZ. 06/18/24 10:50
Face player all the time ...
by bbn1982. 06/18/24 10:25
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,293 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
Mino, squik, AemStones, LucasJoshua, Baklazhan
19061 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: Problems with pointers [new title] [Re: Ditje] #336272
08/02/10 18:30
08/02/10 18:30
Joined: Jul 2010
Posts: 127
Germany, Herford
Ditje Offline OP
Member
Ditje  Offline OP
Member

Joined: Jul 2010
Posts: 127
Germany, Herford
Another mistake must be earlier.

I have a player (the starship) created in WED and added an action with lite-c:

Code:
// Spieler Raumschiff
ENTITY* spieler;

action spieler_aktion()
{
	spieler = my;
	my.STATE = 1;
	
	while(1)
	{
		...

		// Schiessen - Shot
		if (my.STATE == 1) // kein Schuss
	   {
			if(mouse_left) my.STATE = 2;
		}
		if(my.STATE == 2) // Schuss  
		{
			if(last_bomb_x == 15) last_bomb_x = -15;
			else last_bomb_x = 15;
			if(bomb_anzahl < 4)
			{
				bomb = ent_create("bomb.mdl",vector(my.x+last_bomb_x,my.y+10,my.z),move_bomb);
				bomb_anzahl ++;
			}
			my.STATE = 3;
		}
		if (my.STATE == 3)
		{
			if (!mouse_left) my.STATE = 1;
		}
		wait(1);
	}
}



If I try "if(HIT_TARGET) remove(you);" ENTITY 'spieler' got removed when bomb hits an enemy ENITY

Last edited by Ditje; 08/02/10 18:39.
Re: Problems with pointers [new title] [Re: Ditje] #336274
08/02/10 18:49
08/02/10 18:49
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
I don't know where the heck you found this "HIT_TARGET" thing!
Look into the manual for the event handling and the different events.

http://www.conitec.net/beta/aevent_entity.htm

EVENT_ENTITY should do the job for you, because it returns 'you' as the pointer to the touched/hit entity, and then you can 'ent_remove(you);'.

Re: Problems with pointers [new title] [Re: Pappenheimer] #336280
08/02/10 19:35
08/02/10 19:35
Joined: Jul 2010
Posts: 127
Germany, Herford
Ditje Offline OP
Member
Ditje  Offline OP
Member

Joined: Jul 2010
Posts: 127
Germany, Herford
Yeah - that was it - oh my god so silly - I`ve got the HIT_TARGET from a tutorial wink Haven`t understood the manual first - now I tried again step by step and it works Hurray

Vielen vielen Dank!!!

Ditje

Re: Problems with pointers [new title] [Re: Ditje] #336295
08/02/10 21:31
08/02/10 21:31
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
You are really fast in learning Lite-C.
Do you have already experiences with other programming languages?

Re: Problems with pointers [new title] [Re: Pappenheimer] #336334
08/03/10 07:54
08/03/10 07:54
Joined: Jul 2010
Posts: 127
Germany, Herford
Ditje Offline OP
Member
Ditje  Offline OP
Member

Joined: Jul 2010
Posts: 127
Germany, Herford
Oh yeah I just noticed - just half an hour. I`ve read about ENABLE_ENTITY before. But I had to read twice to understand laugh

You`ll find a post about my experiences at the end of

page 3 in the project thread - My first 10 seconds...

and a new thread about my last game here:

A really old project "StapelGabeln"

Cheers

Ditje



Last edited by Ditje; 08/03/10 08:01.
New problems with you pointer [Re: Ditje] #336377
08/03/10 15:03
08/03/10 15:03
Joined: Jul 2010
Posts: 127
Germany, Herford
Ditje Offline OP
Member
Ditje  Offline OP
Member

Joined: Jul 2010
Posts: 127
Germany, Herford
next step next problem laugh I am still working on my function, when enemy got hit. There are several cases.

My problem is case 4. It should just switch skins and change you.TYPE

If I hit one enemy of TYPE 4, all enemies TYPE 4 switch their skins and switch{} doesn`t break;

you.TYPE is now 3 and case 3 done (punkte_spieler+=240 ent_remove(you))


Thank you

Ditje


Code:
...
#define TYPE		 skill4
...
my.TYPE = 4; // capture
...

// Gegner getroffen /////////////////////////////////////////////////
function treffer() 
{ 
		snd_play(snd_explode,100,0);
		switch(you.TYPE)
		{
			case 1: 
				punkte_spieler += 50;
				ent_remove(you);	
				break;
			case 2: 
				punkte_spieler += 80;
				ent_remove(you);
				break;
			case 3:
				punkte_spieler += 240;
				ent_remove(you);
				break;
			case 4:
				// switch skins
				ent_mtlset(you,mtl_rosa,1);
				ent_mtlset(you,mtl_blau,2);
				ent_mtlset(you,mtl_lila,3);
				
				you.TYPE = 3;
				break;
			case 5:
				// code for bonus level
				break;
		}
		wait(1);
		return;
}
my.emask = (ENABLE_ENTITY);
my.event = treffer;
...
function move_bomb()
{
...
   if (event_type == EVENT_ENTITY) // Kollisionsabfrage wird etwas getroffen(?)
   {
       my.STATE = 3;
   }
...
}



Last edited by Ditje; 08/03/10 15:04.
Re: New problems with you pointer [Re: Ditje] #336385
08/03/10 15:28
08/03/10 15:28
Joined: Jan 2004
Posts: 3,023
The Netherlands
Helghast Offline
Expert
Helghast  Offline
Expert

Joined: Jan 2004
Posts: 3,023
The Netherlands
You have to ent_cloneskin before you change it. look it up in the manual under ent_clone

regards,


Formerly known as dennis_fantasy
Portfolio - http://www.designorhea.com/
Project - http://randomchance.cherrygames.org/
Re: New problems with you pointer [Re: Helghast] #336411
08/03/10 17:24
08/03/10 17:24
Joined: Jul 2010
Posts: 127
Germany, Herford
Ditje Offline OP
Member
Ditje  Offline OP
Member

Joined: Jul 2010
Posts: 127
Germany, Herford
yeah - dank je well

Ditje

edit: hmm but switch{} statement still got not stopped by break;

Last edited by Ditje; 08/03/10 17:46.
Page 2 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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