Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (TipmyPip), 18,038 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Selecting of character: HELP!! #352697
01/05/11 12:53
01/05/11 12:53
Joined: Sep 2010
Posts: 97
C
carla_mariz Offline OP
Junior Member
carla_mariz  Offline OP
Junior Member
C

Joined: Sep 2010
Posts: 97
can anyone pls help me???

i'm done with the menu, and now i'm after with selecting of character. i found some codes from the aum, but i couldn't use them.

i just want my program to select characters using arrow keys left and right. and when clicked ok button, it would be placed on the level.

and my another question is, where should i put the code for the selected character? i mean, its action code. laugh

thank you :):):)

Re: Selecting of character: HELP!! [Re: carla_mariz] #352757
01/05/11 19:05
01/05/11 19:05
Joined: Sep 2009
Posts: 84
Theil Offline
Junior Member
Theil  Offline
Junior Member

Joined: Sep 2009
Posts: 84
It would help if you post the code to see what the problem is.

Last edited by Theil; 01/05/11 19:06.
Re: Selecting of character: HELP!! [Re: Theil] #352836
01/06/11 11:20
01/06/11 11:20
Joined: Sep 2010
Posts: 97
C
carla_mariz Offline OP
Junior Member
carla_mariz  Offline OP
Junior Member
C

Joined: Sep 2010
Posts: 97
Here's the code: laugh

Code:
function start_game()
{
	me = NULL;
	level_load (level_wmb);
	wait (3);
	if (player_model == 1)
	{
		player = ent_create (cbabe_mdl, vector(100, 50, 80), player_moves);
	}
	if (player_model == 2)
	{
		player = ent_create (cbabe1_mdl, vector(100, 50, 80), player_moves);
	}
	if (player_model == 3)
	{
		player = ent_create (guard_mdl, vector(100, 50, 80), player_moves);
	}
	if (player_model == 4)
	{
		player = ent_create (hero_mdl, vector(100, 50, 80), player_moves);
	}
}

function player_moves()
{
	my.skin = player_skin;
	while (1)
	{
		my.skill1 = 5 * (key_w - key_s) * time_step; // move with w / s
		my.skill2 = 0;
		my.skill3 = 0;
		my.pan += 3 * (key_a - key_d) * time_step; // rotate with a / d
		move_mode = UNTOUCHABLE;
	//	c_move(my.skill1, nullvector);
		if (key_w + key_s > 0) // if the player is walking
		{
			//ent_cycle("walk", my.skill46); // play "walk" frames animation
			my.skill46 += 5 * time_step; // "walk" animation speed
			my.skill46 %= 100; // loop animation
		}
		camera.x = my.x;
		camera.y = my.y;
		camera.z = my.z + 200;
		camera.tilt = -90;		
		wait (1);
	}
}



it now loads the model whenever i click enter. laugh
but if i put another code into it, by replacing the function player_moves() with function pacman() the action from another script, it would show an error somewhere from the function ghost.

HERE is the part of the another code:
Code:
function ghost_hit()
{
   players_lives -= 1 ;
   my.state = 2;   
   ent_remove(my);
   wait(1);
   ent_create (my, vector(20,20,40), pacman1);
}
	
action pacman()
{
	player = my;
	my.event = ghost_hit;
	my.emask |= ENABLE_IMPACT;
	wait(1);
	vec_set(my.min_x,vector(-20,-20,-40));
	vec_set(my.max_x,vector(20,20,40));
	players_lives = 3;
	while (players_lives > 0) 
	{
		handle_movement();
		c_move(my,dist,absdist,IGNORE_PASSABLE);
	        camera_follow();
		wait(1);
	}
}


action ghost()
{
	VECTOR zdist;
	VECTOR zabsdist;
	VECTOR temp;
	VECTOR p;
	VECTOR p2;
	var hand_palm = 346;
	var hand_top = 338;
	var alert_snd = 1;
	var pain_snd = 0;
	var attack_snd = 0;
	my.eflags |= FAT | NARROW;
	wait(1);
	vec_set(my.min_x,vector(-100,-100,-50))
	vec_set(my.max_x,vector(200,100,200)); 
	players_lives = 3;
	my.state = 0; 
	while(players_lives > 0)
	{
		if(my.state == 0)
		{
			ent_animate(my,"walk",my.skill60,ANM_CYCLE);
			path_set(my, "orgpath");
			my.skill60 += 50 * time_step;
			vec_set(zdist.x,nullvector);
			vec_set(zabsdist.x,nullvector);
			if(vec_dist(my.x,player.x) < 550 && players_lives > 0)   
			{
				my.state = 1;
			}
		}
		if(my.state == 1)
		{
			if(alert_snd == 1)
			{
				snd_play(z_alert,70,0);
				alert_snd = 0;
			}
			vec_set(temp.x,player.x);
			vec_sub(temp.x,my.x);
			vec_to_angle(my.pan,temp);
			my.tilt = 0;
			ent_animate(my,"walk",my.skill60,ANM_CYCLE);
			my.skill60 += 50 * time_step;
			zdist.x = 5 * time_step;
			zdist.y = 0;
			zdist.z = 0;
			vec_set(zabsdist.x,nullvector);
			if(vec_dist(my.x,player.x) > 360)
			{
				my.state = 0;
			}
			if(vec_dist(my.x,player.x) < 50)
			{
				my.state = 2;
			}
			if(players_lives <= 0)
			{
				my.state = 0;
			}
		}
		if(my.state == 2)
		{
			while(my.skill40 < 100)
			{
				vec_for_vertex(p,my,hand_palm); 
				vec_for_vertex(p2,my,hand_top);
				if(c_trace(p,p2,IGNORE_ME | IGNORE_PASSABLE) > 0)	
				{
					attack_snd = 1;
					if(attack_snd == 1)
					{
						snd_play(z_attack,70,0);
						attack_snd = 0;
					}
					if(you == player)
					{
						pain_snd = 1;
						if(pain_snd == 1)
						{
							snd_play(p_pain,70,0);
							pain_snd = 0;
						}
					}
				}
	 			ent_animate(my,"walk",my.skill40,NULL);
				my.skill40 += 50 * time_step;
				wait (1);
			}
			vec_set(zdist.x,nullvector);
			vec_set(zabsdist.x,nullvector);
			if(vec_dist(my.x,player.x) > 70)
			{
				my.state = 1;
			}
			if(players_lives <= 0)
			{
				my.state = 0;
			}
		}
		c_move(my,zdist,zabsdist,IGNORE_PASSABLE);
		wait(1);
	}
	set(my,PASSABLE);
	snd_play(z_death,70,0);
	my.skill60 = 0;
	while(my.skill60 < 100)
	{
		ent_animate(my,"walk",my.skill60,NULL);
		my.skill60 += 5 * time_step;
		wait(1);
	}
}




and regarding with that code, i just modified it from another source. grin
i want to make the player decrease a life if he has been attacked by the ghost. and make him disappear and be placed on his starting position. is there a way to make it possible?

thanks laugh


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

Gamestudio download | 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