Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,014 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
your shooter template #319185
04/12/10 20:08
04/12/10 20:08
Joined: Aug 2008
Posts: 408
mi usa
sadsack Offline OP
Senior Member
sadsack  Offline OP
Senior Member

Joined: Aug 2008
Posts: 408
mi usa
Hi George,


I made a small map and put it in your shooter template. Now the player can not move or jump. Do I have to all code to my Map??
renny

Last edited by sadsack; 04/12/10 20:09.

I have A7 Commercial .............. Now I just need to learn how to use it

Re: your shooter template [Re: sadsack] #319287
04/13/10 20:06
04/13/10 20:06
Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
George Offline

Expert
George  Offline

Expert

Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
You have to add a player model and attach it my player action. To make the things easier, save your level with the same name as my level, overwriting the existing one. Then, build it and run it - everything should work fine.

Re: your shooter template [Re: George] #319309
04/13/10 23:12
04/13/10 23:12
Joined: Aug 2008
Posts: 408
mi usa
sadsack Offline OP
Senior Member
sadsack  Offline OP
Senior Member

Joined: Aug 2008
Posts: 408
mi usa
Thank you
renny


I have A7 Commercial .............. Now I just need to learn how to use it

Re: your shooter template [Re: sadsack] #319396
04/14/10 18:10
04/14/10 18:10
Joined: Aug 2008
Posts: 408
mi usa
sadsack Offline OP
Senior Member
sadsack  Offline OP
Senior Member

Joined: Aug 2008
Posts: 408
mi usa
Hello,
Well I tryed what you said. I took my map and change the name to shooter and I still can not move in the map. It come up ok and I can see it is my map. I looked at your map( the city) and saw all that was add to it. I made sure that my map had the very thing that your map had in wed. Anything come to mind at what I could try next.
Thank you
renny


I have A7 Commercial .............. Now I just need to learn how to use it

Re: your shooter template [Re: sadsack] #319508
04/15/10 13:30
04/15/10 13:30
Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
George Offline

Expert
George  Offline

Expert

Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
I guess that my level runs OK, right? Then it might be a problem with the size of your level or maybe you didn't surround the level with a hollowed cube.

Re: your shooter template [Re: George] #319526
04/15/10 14:51
04/15/10 14:51
Joined: Aug 2008
Posts: 408
mi usa
sadsack Offline OP
Senior Member
sadsack  Offline OP
Senior Member

Joined: Aug 2008
Posts: 408
mi usa
I did not put a cube around it. I will try that
Thank You
renny


I have A7 Commercial .............. Now I just need to learn how to use it

Re: your shooter template [Re: sadsack] #321288
04/27/10 22:07
04/27/10 22:07
Joined: Aug 2008
Posts: 408
mi usa
sadsack Offline OP
Senior Member
sadsack  Offline OP
Senior Member

Joined: Aug 2008
Posts: 408
mi usa
Hello George,
I try every thing I know and still get my map tp work in your shooter Template.
So I tryed to put every thing in as code. Not using it as a template. Here is the code, it will not compile.



Code:
///////////////////////////////////////////////////////////////////////////////////////////
// Template shooter game example
// Written by George Pirvu - v1.0 March 2010
///////////////////////////////////////////////////////////////////////////////////////////

#include <acknex.h>
#include <default.c>
 

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Template shooter player / camera code
// Written by George Pirvu - v1.0 March 2010
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

var tshooter_player_speed = 25; // player's movement speed
var tshooter_fwdbk_accel = 7; // player's forward / backward acceleration
var tshooter_side_accel = 3; // player's sideway (strafe) acceleration
var tshooter_friction = 1.5; // player's friction - this value should always be greater than 1
var tshooter_fallspeed = 1; // player's fall down speed
var tshooter_jump = 20; // player's jumping force
var tshooter_resilience = 4; // pushes the player upwards a bit if it sinks too much in the floor
var tshooter_disttoground = 64; // distance between the origin of player's model and the ground (used by the camera as well)
var tshooter_camera_h = 12; // horizontal camera acceleration
var tshooter_camera_h_frict = 0.95; // always use a value below 1 here
var tshooter_camera_v = 8; // vertical camera acceleration
var tshooter_camera_v_frict = 0.8; // always use a value below 1 here

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// default player movement keys used by the shooter template: WSAD, space to jump and left shift to run
STRING* key_forward = "w";
STRING* key_backward = "s";
STRING* key_left = "a";
STRING* key_right = "d";
STRING* key_jump = "space";
STRING* key_run = "shiftl"; // left shift key


////////////////////////////////////////////////////////////////////////////////////////////
action t_shooter_player()
{
	set (my, INVISIBLE); // using a 1st person player
	var forward_on, backward_on, right_on, left_on, jump_on, run_on;
	var camera_h_speed = 0, camera_v_speed = 0, current_height = 0, jump_handle;
	VECTOR horizontal_speed, vertical_speed, temp;
	vec_set(horizontal_speed.x, nullvector); // initialize this vector
	vec_set(vertical_speed.x, nullvector); // initialize this vector
	while(1)
	{
		// key input start
		forward_on = 0; // reset all the key values at the beginning of each frame
		backward_on = 0;
		right_on = 0;
		left_on = 0;
		jump_on = 0;
		run_on = 0;
		// set the proper variables if their corresponding keys are pressed
		if(key_pressed(key_for_str(key_forward)))
			forward_on = 1;
		if(key_pressed(key_for_str(key_backward)))
			backward_on = 1;  
		if(key_pressed(key_for_str(key_left)))
			left_on = 1;
		if(key_pressed(key_for_str(key_right)))
			right_on = 1;  
		if(key_pressed(key_for_str(key_jump)))
			jump_on = 1;     
		if(key_pressed(key_for_str(key_run)))
			run_on = 1;     
		// key input end

		// camera code
		vec_set(camera.x, my.x);
		// accelerate camera's pan and tilt angles depending on mouse_force.x and mouse_force.y in order to create a smooth camera
		camera.pan -= accelerate (camera_h_speed, tshooter_camera_h * (mouse_force.x), tshooter_camera_h_frict);
		camera.tilt += accelerate (camera_v_speed, tshooter_camera_v * (mouse_force.y), tshooter_camera_v_frict);
		my.pan = camera.pan;
		// camera code end

		// player movement start
		// player's horizontal speed (forward / backward / sideways) movement uses acceleration and friction as well
		horizontal_speed.x = (horizontal_speed.x > 0) * maxv(horizontal_speed.x - time_step * tshooter_friction, 0) + (horizontal_speed.x < 0) * minv(horizontal_speed.x + time_step * tshooter_friction, 0);
		if(forward_on)
		{
			horizontal_speed.x += time_step * tshooter_fwdbk_accel;
			horizontal_speed.x = minv(horizontal_speed.x, time_step * tshooter_player_speed  * (1 + run_on));
		}    
		if(backward_on)
		{
			horizontal_speed.x -= time_step * tshooter_fwdbk_accel;
			horizontal_speed.x = maxv(horizontal_speed.x, -(time_step * tshooter_player_speed * (1 + run_on)));
		}    
		horizontal_speed.y = (horizontal_speed.y > 0) * maxv(horizontal_speed.y - time_step * tshooter_friction, 0) + (horizontal_speed.y < 0) * minv(horizontal_speed.y + time_step * tshooter_friction, 0);
		if(left_on)
		{
			horizontal_speed.y += time_step * tshooter_side_accel;
			horizontal_speed.y = minv(horizontal_speed.y, time_step * tshooter_player_speed * (1 + run_on));
		}
		if(right_on)
		{
			horizontal_speed.y -= time_step * tshooter_side_accel;
			horizontal_speed.y = maxv(horizontal_speed.y, -(time_step * tshooter_player_speed * (1 + run_on)));
		}    	
		// disable the friction, allow smooth gliding along the surfaces
		move_friction = 0;
		vec_set(temp.x, my.x);
		temp.z -= 10000;
		current_height = c_trace(my.x, temp.x, IGNORE_ME | IGNORE_PASSABLE | USE_BOX | GLIDE); // compute the distance between player's origin and the floor below its feet 
		if(current_height < (tshooter_disttoground * 0.97)) // if it is smaller than the default value (64 quants) push the player upwards a bit (resilience) - 0.97 gives the hysteresis
		{
			vertical_speed.z = tshooter_resilience * time_step;
		}
		else
		{
			if(current_height > tshooter_disttoground) // if it is bigger than the default value (64 quants), move the player downwards
			{
				vertical_speed.z -= tshooter_fallspeed * time_step;
			}
			else // sitting properly on the floor?
			{
				vertical_speed.z = 0; // then don't do anything on the z axis
			}
		}    
		if((jump_on) && (current_height < tshooter_disttoground)) // jumping while player's feet are placed on the floor?
		{
			if (!snd_playing (jump_handle)) // if no jumping sound is playing, play the jumping sound now
				jump_handle = snd_play(tshooter_jump_wav, 70, 0);
			vertical_speed.z = tshooter_jump * time_step; // push the player upwards
		}
		// this c_move instruction does all the job, moving the player in the direction given by horizontal_speed (forward, backward, sideways) and vertical_speed (on the z axis)
		c_move (my, horizontal_speed.x , vertical_speed.x, IGNORE_PASSABLE | USE_BOX | GLIDE); 
		// player movement end
		wait(1);
	}
}


function main()
{
	fps_max = 75; // limit the frame rate to 75 fps (not really needed)
	video_screen = 1; // start the game in full screen mode
	video_mode = 8; // run at a 1024x768 pixels resolution
	level_load ("map1_1.wmb");
	wait (3); 
	ent_create("player.mdl",vector(0,0,0),t_shooter_player);
	
}



now you can see I think what I am trying to do. I hope you have time to help, I like your code.
renny


I have A7 Commercial .............. Now I just need to learn how to use it

Re: your shooter template [Re: sadsack] #321303
04/28/10 05:15
04/28/10 05:15
Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
George Offline

Expert
George  Offline

Expert

Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
What do you mean by "it will not compile"?

Re: your shooter template [Re: sadsack] #321343
04/28/10 12:27
04/28/10 12:27
Joined: Aug 2008
Posts: 408
mi usa
sadsack Offline OP
Senior Member
sadsack  Offline OP
Senior Member

Joined: Aug 2008
Posts: 408
mi usa
error in main.c

I don't know what type of error that is.
renny


I have A7 Commercial .............. Now I just need to learn how to use it

Re: your shooter template [Re: sadsack] #321344
04/28/10 13:05
04/28/10 13:05
Joined: Jun 2006
Posts: 379
Flevoland, 5 meters under wate...
Roel Offline
Senior Member
Roel  Offline
Senior Member

Joined: Jun 2006
Posts: 379
Flevoland, 5 meters under wate...
have you tried to debug it using f6 in the script editor?
the engine now gives a more detailed error message


Check out the throwing game here: The throwing game
Page 1 of 2 1 2

Moderated by  George 

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