Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, ozgur), 1,392 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19055 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
my.pan = my.pan + 5; doesnt work? #222787
08/21/08 00:35
08/21/08 00:35
Joined: Aug 2008
Posts: 16
J
justgamefreak Offline OP
Newbie
justgamefreak  Offline OP
Newbie
J

Joined: Aug 2008
Posts: 16
hiho when i used following codes, when i press "d" key it makes pan +5 then it makes it -5 again;

Code:
action megamerr()
{


myplayer = me;

	
	
    ph_setgravity (vector(0, 0, -386)); 
    phent_settype (myplayer, PH_RIGID, PH_BOX); 
    phent_setmass (myplayer, 80, PH_BOX); 
    phent_setfriction (myplayer, 20);
   phent_setelasticity (myplayer, 0, 100); // set the elasticity



    while (1)
    {
  
	if(key_d)
	{
		my.pan = my.pan + 5;
	}
	
    	if(key_w)
    	{
    		myplayer_speed.x = 3 ;
        myplayer_speed.y = 0 ;
        myplayer_speed.z = 0; 
        phent_addvelcentral (myplayer, myplayer_speed); 
    		ent_animate(myplayer, "walk", walk_percentage, ANM_CYCLE);
 walk_percentage += 20 * time_step; // 3 = animation speed for "walk"
 
        }

        
            	else if(key_s)
    	{
    		myplayer_speed.x = -3 ;
    		
        myplayer_speed.y = 0 ;
        myplayer_speed.z = 0; 
        phent_addvelcentral (myplayer, myplayer_speed); 
    		ent_animate(myplayer, "walk", walk_percentage, ANM_CYCLE);
 walk_percentage += 20 * time_step; // 3 = animation speed for "walk"


        }
      


      

	        else
        {
        	phent_clearvelocity(myplayer); 
}
        
        
        
        
      
        wait(1);
}



	
}


Re: my.pan = my.pan + 5; doesnt work? [Re: justgamefreak] #222791
08/21/08 00:52
08/21/08 00:52
Joined: Dec 2006
Posts: 1,086
Queensland - Australia
Nidhogg Offline
Serious User
Nidhogg  Offline
Serious User

Joined: Dec 2006
Posts: 1,086
Queensland - Australia
try my.pan += 5;


Windows XP SP3
Intel Dual Core CPU: E5200 @ 2.5GHz
4.00GB DDR3 Ram
ASUS P5G41T-M LX
PCIE x16 GeForce GTS 450 1Gb
SB Audigy 4
Spyware Doctor with AntiVirus
Re: my.pan = my.pan + 5; doesnt work? [Re: Nidhogg] #222793
08/21/08 00:56
08/21/08 00:56
Joined: Aug 2008
Posts: 16
J
justgamefreak Offline OP
Newbie
justgamefreak  Offline OP
Newbie
J

Joined: Aug 2008
Posts: 16
same, when i press d it turns elft abit then it goes back old position. when i delete phyics it fixes is it about physics?

Re: my.pan = my.pan + 5; doesnt work? [Re: justgamefreak] #222799
08/21/08 01:45
08/21/08 01:45
Joined: Aug 2008
Posts: 16
J
justgamefreak Offline OP
Newbie
justgamefreak  Offline OP
Newbie
J

Joined: Aug 2008
Posts: 16
solved, use phent_enable and disable physics when press d key

Last edited by justgamefreak; 08/21/08 01:45.
Re: my.pan = my.pan + 5; doesnt work? [Re: justgamefreak] #222800
08/21/08 01:47
08/21/08 01:47
Joined: Sep 2005
Posts: 274
Switzerland - Zurich
zwecklos Offline
Member
zwecklos  Offline
Member

Joined: Sep 2005
Posts: 274
Switzerland - Zurich
Hi there,
Yes, it is because of the physics I guess.
Try:

Code:
if(key_d)
{
phent_enable(myplayer,0);//disable physic for comon movement
myplayer.pan += 5;
phent_enable(myplayer,1);//enable physic for comon movement
}


But this is not a very good solution, because you will lose the physic behaviour.
Better try to work here with "phent_addtorquelocal".

greetz

zwecki

edit:
argh Im too slow grin

Last edited by zwecklos; 08/21/08 01:48.
Re: my.pan = my.pan + 5; doesnt work? [Re: zwecklos] #222802
08/21/08 01:54
08/21/08 01:54
Joined: Aug 2008
Posts: 16
J
justgamefreak Offline OP
Newbie
justgamefreak  Offline OP
Newbie
J

Joined: Aug 2008
Posts: 16
hmm after i disable physic, even i make my pan+5, and press "w" it goes towards x again, doesnt follow new pan, i want move like
c_move (my, vector(15*time_step, 0, 0), nullvector, GLIDE);

same with if i use phent_addtorquelocal(my, vector(0,0,10000));

too.

can you help me about that king of movement with physic?

Last edited by justgamefreak; 08/21/08 01:58.
Re: my.pan = my.pan + 5; doesnt work? [Re: justgamefreak] #222810
08/21/08 02:15
08/21/08 02:15
Joined: Aug 2008
Posts: 16
J
justgamefreak Offline OP
Newbie
justgamefreak  Offline OP
Newbie
J

Joined: Aug 2008
Posts: 16
i read that phent_addvelcentra is independent of the body's current orientation

can someone give me movement codes that works with body's current orientation.

Re: my.pan = my.pan + 5; doesnt work? [Re: justgamefreak] #222882
08/21/08 13:30
08/21/08 13:30
Joined: Sep 2005
Posts: 274
Switzerland - Zurich
zwecklos Offline
Member
zwecklos  Offline
Member

Joined: Sep 2005
Posts: 274
Switzerland - Zurich
Hi there,
Yes you are right.

Replace
phent_addvelcentral(myplayer, myplayer_speed);
with
phent_addvellocal(myplayer, myplayer_speed, nullvector);

phent_addvellocal moves your physic entity dependant on its orientation like c_move does.

greetz

zwecki

Re: my.pan = my.pan + 5; doesnt work? [Re: zwecklos] #223509
08/24/08 19:55
08/24/08 19:55
Joined: Aug 2008
Posts: 16
J
justgamefreak Offline OP
Newbie
justgamefreak  Offline OP
Newbie
J

Joined: Aug 2008
Posts: 16
nope, theese codes arent working too, when i press "w" it just turns doesnt go towards its pan.


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