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
3 registered members (Konsti, AndrewAMD, 1 invisible), 1,376 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
move different entity with the same speed #253737
02/26/09 14:23
02/26/09 14:23
Joined: Aug 2008
Posts: 49
V
Vyse220 Offline OP
Newbie
Vyse220  Offline OP
Newbie
V

Joined: Aug 2008
Posts: 49
I need to move 2 enemy with the same exactly speed.
Code:
action move_ambsolid(){
	my.ambient = 100;
	my.z = player.z;
	my.polygon = on;
	var speed = 10;
	my.passable = on;
	move_mode = IGNORE_YOU + IGNORE_PASSABLE + IGNORE_PUSH + ACTIVATE_TRIGGER + GLIDE;
	var enable_polycollision = 0;
			while(my.x > -8000){
			if(my.x < 1000){
				my.passable = off;
			}
			ent_move(nullvector, nullvector);
			my.x -= 30.5*time_step;
			wait(1);
		}
	ent_remove(my);
}

Code:
action part_enemy
{
	my.ambient = -100;
	while (player == null) {wait (1);}
	my.z = player.z; // set the same height for the enemy ships and the player
	var shuttle_speed;
	my.skill10 = 2;
	my.skill40 = 5; // I'm a ship
	my.enable_impact = on;
	my.event = destroy_them;
	shuttle_speed.x = -1.99*time_step;
	shuttle_speed.y = 0;
	shuttle_speed.z = 0;
	while ((my.x > -800) && (my.skill10 > 0))
	{
		move_mode = ignore_you + ignore_passable + glide;
		ent_move (nullvector, shuttle_speed);
		if ((vec_dist (my.x, player.x) < 800) && (total_frames % 90 == 1)) // random firing intervals
		{
			if (my.x > player.x) // still got the chance to hit the player?
			{
				snd_play (fire1_wav, 40, 0);
				ent_create(sphere_mdl, vector(my.x+5,my.y,my.z) , move_bullet4);
			}
		}
		wait (1);
	}
	ent_create(explosion_pcx, vector(my.x, my.y, my.z), animate_explosion);
	ent_remove(me);
}

These are the 2 entities, this seems to move with the same speed but one move with - 30*time_step and the other with -2*time_step
The problem is that sometimes the speed of move_ambsolid change and i need it to be on the same speed of the enemy.
Can somebody help me?

Re: move different entity with the same speed [Re: Vyse220] #253769
02/26/09 17:36
02/26/09 17:36
Joined: May 2008
Posts: 331
Lithuania, Vilnius
Jaxas Offline
Senior Member
Jaxas  Offline
Senior Member

Joined: May 2008
Posts: 331
Lithuania, Vilnius
create variable which determine enemy speed, and then you need you set it to player speed wink


The smaller the bug, the harder it is to kill.
_________________________________________
Forklift DEMO (3dgs)
Re: move different entity with the same speed [Re: Vyse220] #253781
02/26/09 19:49
02/26/09 19:49
Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
George Offline

Expert
George  Offline

Expert

Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
Limit the frame rate to 60 (or so) and then move the entities without using time_step (use only numerical values).

Re: move different entity with the same speed [Re: George] #253848
02/27/09 10:35
02/27/09 10:35
Joined: Aug 2008
Posts: 49
V
Vyse220 Offline OP
Newbie
Vyse220  Offline OP
Newbie
V

Joined: Aug 2008
Posts: 49
without the time_step i'm sure that the speed of the will be the same every time?
And the game speed will change if the game is played on another pc?

Re: move different entity with the same speed [Re: Vyse220] #253914
02/27/09 18:02
02/27/09 18:02
Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
George Offline

Expert
George  Offline

Expert

Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
Yes, the speed will be the same if all the PCs can deliver at least 60 fps. If you plan to run the game on weak PCs, set fps_max to a lower value.


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