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
3 registered members (TipmyPip, AndrewAMD, NewbieZorro), 16,655 guests, and 7 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
Page 1 of 2 1 2
Help me stop ball disappearing #326930
06/03/10 19:35
06/03/10 19:35
Joined: Apr 2010
Posts: 59
Lagos, Nigeria
gameaddict Offline OP
Junior Member
gameaddict  Offline OP
Junior Member

Joined: Apr 2010
Posts: 59
Lagos, Nigeria
I've been trying to figure this out but the solution is not forthcoming. My ball keeps disappearing to it's original location whenever I break the movement loop. It's supposed to still be at the player's feet when I call the pass() of shot() functions but instead, it returns to it's original position first. In fact, while moving, I am unable to move if I am at the original location because collision detection with the ball is taking place. I have to turn to move to other locations with the ball.

Please is there a way I can update the real ball position to the current x, y and z locations or how can I implement it in the current while loop. Any help or advice is greatly appreciated.

Here are the codes:

Code:
action theBall()
{
	while(!player) wait(1);
	
   set(my, SHADOW);
	
	phent_settype(my, PH_RIGID, PH_SPHERE);
	phent_setmass(my, 1, PH_SPHERE);
	phent_setfriction(my,90);
	phent_setelasticity(my,75,100);
	phent_setdamping(my,30,5);
	phent_addvelcentral(my,vector(10,10,0));
	ph_setgravity(vector(0,0,-500));
   

	//dcam();
	my.emask |= ENABLE_FRICTION;
	
	
	while(1){	
	
     if((key_w || key_a || key_s || key_d) && vec_dist(my.x, player.x) <= 20){
        move_with_ball();
     }	 
      wait(1);
   }
}



The ball movement:

Code:
function move_with_ball()
{

while(my == NULL) wait(1);


while(1){
		proc_mode = PROC_LATE;

      vec_set(my.x,vector(player.x + 13 * cos(player.pan),player.y + 13 * sin(player.pan), player.z - 12));
      my.roll+=20;
      my.tilt+=20;
      
      if(key_x){
      	pass();
      	break;
      }
      
      if(key_space){
      	shot();
      	break;
      }
      
      if(key_1){
      break;	
      }	
       
      
wait(1);
}
}




I know I can.
Re: Help me stop ball disappearing [Re: gameaddict] #326957
06/03/10 20:16
06/03/10 20:16
Joined: Apr 2006
Posts: 737
Ottawa, Canada
O
Ottawa Offline
User
Ottawa  Offline
User
O

Joined: Apr 2006
Posts: 737
Ottawa, Canada
Hi!

Your wait (1) is outside the while.
Place inside.

sorry it's ok


Last edited by Ottawa; 06/03/10 20:18.

Hope this helps!
Ottawa laugh

Ver 7.86.2 Pro and Lite-C
Re: Help me stop ball disappearing [Re: Ottawa] #327022
06/04/10 07:31
06/04/10 07:31
Joined: Apr 2010
Posts: 59
Lagos, Nigeria
gameaddict Offline OP
Junior Member
gameaddict  Offline OP
Junior Member

Joined: Apr 2010
Posts: 59
Lagos, Nigeria
The code is working but how to update original ball position so it doesn't disappear from players feet first before it calls the pass() or other functions?


I know I can.
Re: Help me stop ball disappearing [Re: gameaddict] #327023
06/04/10 08:24
06/04/10 08:24
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
try something like this:
Code:
phent_settype(my, 0, 0);

vec_set(my.x,vector(player.x + 13 * cos(player.pan),player.y + 13 * sin(player.pan), player.z - 12));
my.roll+=20;
my.tilt+=20;

phent_settype(my, PH_RIGID, PH_SPHERE);




Visit my site: www.masterq32.de
Re: Help me stop ball disappearing [Re: MasterQ32] #327118
06/04/10 17:49
06/04/10 17:49
Joined: Apr 2010
Posts: 59
Lagos, Nigeria
gameaddict Offline OP
Junior Member
gameaddict  Offline OP
Junior Member

Joined: Apr 2010
Posts: 59
Lagos, Nigeria
Thanks! It's no longer disappearing but the ball is always pushing the player backwards whether moving or not. If I remove the my.roll parts, It moves the player along the z axis. I tried setting gravity again inside the loop but it didn't help.


I know I can.
Re: Help me stop ball disappearing [Re: gameaddict] #327234
06/05/10 11:45
06/05/10 11:45
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
i think you could delete the roll and tilt change, thy engine will do it


Visit my site: www.masterq32.de
Re: Help me stop ball disappearing [Re: MasterQ32] #327274
06/05/10 16:24
06/05/10 16:24
Joined: Apr 2010
Posts: 59
Lagos, Nigeria
gameaddict Offline OP
Junior Member
gameaddict  Offline OP
Junior Member

Joined: Apr 2010
Posts: 59
Lagos, Nigeria
Thanks. I've remove it but the ball is still moving the player upwards and the ball is really slow when I call my pass or shot function. How can I stop the upwards movement?

Here's my edited function:

Code:
function move_with_ball()
{

while(my == NULL) wait(1);


while(1){
		proc_mode = PROC_LATE;

		phent_settype(my, 0, 0);
	   

      vec_set(my.x,vector(player.x + 13 * cos(player.pan),player.y + 13 * sin(player.pan), player.z - 12));
      
     
      phent_settype(my, PH_RIGID, PH_SPHERE);
      
      if(key_x){
      	pass();
      	break;
      }
      
      if(key_space){
      	shot();
      	break;
      }
      
      if(key_1){
      break;	
      }	
       
      
wait(1);
}
}



my pass function:

Code:
function pass()
{
	VECTOR vPass;	
   vPass.x = 3; vPass.y = 0; vPass.z = 0.5;
	vec_rotate(vPass, player.pan);
	phent_addvelcentral(my, vPass);
	
}




I know I can.
Re: Help me stop ball disappearing [Re: gameaddict] #327277
06/05/10 16:44
06/05/10 16:44
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
can you post you players function??
because i think i know where your mistake is, but i must see the players code

before, add to you balls action
Code:
action theBall()
{
       set(me,POLYGON);
       c_setminmax(me);


i don't know if it works, but maybe


Visit my site: www.masterq32.de
Re: Help me stop ball disappearing [Re: MasterQ32] #327288
06/05/10 17:44
06/05/10 17:44
Joined: Apr 2010
Posts: 59
Lagos, Nigeria
gameaddict Offline OP
Junior Member
gameaddict  Offline OP
Junior Member

Joined: Apr 2010
Posts: 59
Lagos, Nigeria
It's still moving upwards. Here are the codes:

player:

Code:
action player_action()
{ 
	
		while(1){
			player = me;
			if(key_1 || key_x || (key_x && vec_dist(my.x, player.x) <= 20)){
				wait(1);
		 rot_player(); //change player
		 	
		}
		handle_movement();
		handle_gravity();
		handle_animation(1);
		wait(1);
	  }
	
}



ball action:

Code:
action theBall()
{
	while(!player) wait(1);
	
   //set(my, SHADOW);
   set(me,POLYGON);
   c_setminmax(me);
   	
	phent_settype(my, PH_RIGID, PH_SPHERE);
	phent_setmass(my, 1, PH_SPHERE);
	phent_setfriction(my,90);
	phent_setelasticity(my,75,100);
	phent_setdamping(my,30,5);
	phent_addvelcentral(my,vector(10,10,0));
	ph_setgravity(vector(0,0,-500));
   

	my.emask |= ENABLE_FRICTION;
	
	
	while(1){	
	
     if((key_w || key_a || key_s || key_d) && vec_dist(my.x, player.x) <= 20){

        move_with_ball();
     }	 
      wait(1);
   }
}



the ball movement:

Code:
function move_with_ball()
{

while(my == NULL) wait(1);


while(1){
		proc_mode = PROC_LATE;

		phent_settype(my, 0, 0);

      vec_set(my.x,vector(player.x + 13 * cos(player.pan),player.y + 13 * sin(player.pan), player.z - 12));
      
      
     
      phent_settype(my, PH_RIGID, PH_SPHERE);
      
      if(key_x){
      	pass();
      	break;
      }
      
      if(key_space){
      	shot();
      	break;
      }
      
      if(key_1){
      break;	
      }	
       
      
wait(1);
}
}



Thanks.


I know I can.
Re: Help me stop ball disappearing [Re: gameaddict] #327317
06/05/10 20:45
06/05/10 20:45
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
i think you you the c_***-functions in this two:
Code:
handle_movement();
handle_gravity();



try to set FLAG2 of the ball and use the IGNORE_FLAG2 - Option in you c_***-functions

i think this would work


Visit my site: www.masterq32.de
Page 1 of 2 1 2

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