Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (7th_zorro, degenerate_762, AndrewAMD, ozgur), 774 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
c_move in negative area #384766
10/07/11 12:54
10/07/11 12:54
Joined: Oct 2011
Posts: 4
Germany
I
IngoP Offline OP
Guest
IngoP  Offline OP
Guest
I

Joined: Oct 2011
Posts: 4
Germany
Hello,
i have a problem with the c_move. I hope, someone could help me.
if I say in the script c_move with positive x or y vectors, it works, but if i use -1 in x or y it don't moves or it duplicates it and there are 2 or 3 models...
(dist_down is the distance between the model and the landscape, but it seems to work correct)
Here's the code that works (in while loop):
Code:
c_move(me,vector(1,0,0),vector(0,0,-dist_down),IGNORE_PASSABLE | GLIDE); 
c_move(me,vector(0,1,0),vector(0,0,-dist_down),IGNORE_PASSABLE | GLIDE);


don't works:
Code:
c_move(me,vector(-1,0,0),vector(0,0,-dist_down),IGNORE_PASSABLE | GLIDE); 
c_move(me,vector(0,-1,0),vector(0,0,-dist_down),IGNORE_PASSABLE | GLIDE);



best regards
IngoP

Re: c_move in negative area [Re: IngoP] #384768
10/07/11 14:18
10/07/11 14:18
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
What do you mean by 'duplicate'? Can't believe that it doesn't work because there are probably a lot of projects with a movement code similar to this, where I never heard of that it doesn't work:
Code:
c_move(me,vector(key_w - key_s,0,0),vector(0,0,-dist_down),IGNORE_PASSABLE | GLIDE);



Re: c_move in negative area [Re: Pappenheimer] #385005
10/11/11 09:45
10/11/11 09:45
Joined: Oct 2011
Posts: 4
Germany
I
IngoP Offline OP
Guest
IngoP  Offline OP
Guest
I

Joined: Oct 2011
Posts: 4
Germany
ok, hmm than I have a problem with my function... (the logic works if I proof it with printf at some points) I searched over 2 weeks now, could you help me please? The Model is on 0,0 positiv works, but negatives, he stands still.
Here's my code:

Code:
var hausx= -150;
var hausy = -400;
var anzahlwasser = 1;
var wasserx = 200;
var wassery = 300;
var anzahlwasserschl = 0;
var anzahlwasserschl2 = 0;
var zielx1 = 0;
var ziely1 = 0;
var zielx2 = 0;
var ziely2 = 0;

action player_walk()
{ 
// if necessary, adjust the bounding box to give the entity 'floor room' (see remarks) 
// my.min_z *= 0.5;

   var speed_down = 0;   // downward speed by gravity
   var anim_percent = 0; // animation percentage
   VECTOR vFeet;
   vec_for_min(vFeet,me); // vFeet.z = distance from player origin to lowest vertex
	var dist_ahead = 5*time_step;
   while (1)
   {
// rotate the player using the [A] and [D] keys      
      //my.pan += 5*(key_a-key_d)*time_step; 
      my.pan = 0;

// determine the ground distance by a downwards trace
      var dist_down; 
      if (c_trace(my.x,vector(my.x,my.y,my.z-5000),IGNORE_ME | IGNORE_PASSABLE | USE_BOX) > 0)
         dist_down = my.z + vFeet.z - target.z; // get distance between player's feet and the ground
      else
         dist_down = 0;

// apply gravity when the player is in the air
      if (dist_down > 0)  // above floor, fall down with increasing speed
         dist_down = clamp(dist_down,0,accelerate(speed_down,5,0.1));
      else                // on or below floor, set downward speed to zero
         speed_down = 0;

// move the player using the [W] and [S] keys      
      //var dist_ahead = 5*(key_w-key_s)*time_step;
      var dist_ahead = 5*time_step;
      dist_ahead = sign(dist_ahead)*(abs(dist_ahead) + 0.5*dist_down); // adapt the speed on slopes
  

  
      if(anzahlwasser > 0){
		zielx1 = wasserx;
		ziely1 = wassery;
		
		if (anzahlwasserschl == 0)
		{
      if(me.x < zielx1)
      {
     		c_move(me,vector(1,0,0),vector(0,0,-dist_down),IGNORE_PASSABLE | GLIDE); // move the player
      }
      
      if(me.x > zielx1)
      {
      	c_move(me,vector(-1,0,0),vector(0,0,-dist_down),IGNORE_PASSABLE | GLIDE); // move the player
      }
      
      if(me.y < ziely1){
      	c_move(me,vector(0,1,0),vector(0,0,-dist_down),IGNORE_PASSABLE | GLIDE); // move the player
      }
      
      if(me.y > ziely1){
      	c_move(me,vector(0,-1,0),vector(0,0,-dist_down),IGNORE_PASSABLE | GLIDE); // move the player
      }
      }
     
		if(me.x == zielx1 && me.y == ziely1){
			
		anzahlwasserschl2 = 1;
		}
		
		if(anzahlwasserschl2 == 1){
		anzahlwasserschl = 1;
		zielx2 = hausx;
		ziely2 = hausy;

   	if(me.x < zielx2)
      {
     		c_move(me,vector(1,0,0),vector(0,0,-dist_down),IGNORE_PASSABLE | GLIDE); // move the player
      }
      
      if(me.x > zielx2)
      {
      	c_move(me,vector(0,0,0),vector(0,0,-dist_down),IGNORE_PASSABLE | GLIDE); // move the player
      }
      
      if(me.y < ziely2){
      	c_move(me,vector(0,1,0),vector(0,0,-dist_down),IGNORE_PASSABLE | GLIDE); // move the player
      }
      
      if(me.y > ziely2){
      	c_move(me,vector(0,0,0),vector(0,0,-dist_down),IGNORE_PASSABLE | GLIDE); // move the player
      }
      
		if(me.x == zielx2 && me.y == ziely2){
			printf("fertig:",(double)anzahlwasser);
			anzahlwasser = anzahlwasser - 1;	
			anzahlwasserschl = 0;
			anzahlwasserschl2 = 0;			
		}

		}

	}



	                    
      //c_move(me,vector(100,0,0),vector(0,0,0),IGNORE_PASSABLE | GLIDE); // move the player
// animate the player according to its moved distance
      if (dist_ahead != 0) // player is moving ahead
      {
         anim_percent += 1.3*dist_ahead; // 1.3 = walk cycle percentage per quant
         ent_animate(me,"walk",anim_percent,ANM_CYCLE); // play the "walk" animation
      }
      else // player stands still
      { 
         anim_percent += 5*time_step; 
         ent_animate(me,"stand",anim_percent,ANM_CYCLE); // play the "stand" animation
      }
      wait(1);
   }
}



Re: c_move in negative area [Re: IngoP] #385007
10/11/11 10:24
10/11/11 10:24
Joined: Mar 2002
Posts: 1,774
Magdeburg
F
FlorianP Offline
Serious User
FlorianP  Offline
Serious User
F

Joined: Mar 2002
Posts: 1,774
Magdeburg
I dont get what u mean with duplicate and what ur script is supposed to do as f.i. dist_ahead is never used - but one problem lies probably here:

Code:
if(me.x < zielx1)
      {
     		c_move(me,vector(1,0,0),vector(0,0,-dist_down),IGNORE_PASSABLE | GLIDE); // move the player
      }
      
      if(me.x > zielx1)
      {
      	c_move(me,vector(-1,0,0),vector(0,0,-dist_down),IGNORE_PASSABLE | GLIDE); // move the player
      }



lets say zielx1 is 0.5 and my.x is 0.
Then the entity is moved to my.x 1 - my.x is now > zielx1, so the entity is moved back to 0 (while 'falling' twice)


I <3 LINQ
Re: c_move in negative area [Re: FlorianP] #385010
10/11/11 15:00
10/11/11 15:00
Joined: Oct 2011
Posts: 4
Germany
I
IngoP Offline OP
Guest
IngoP  Offline OP
Guest
I

Joined: Oct 2011
Posts: 4
Germany
I thought about it, yes, it could be a Problem, but me.x is 0 and zielx1 is -150. I tested it now without any if, but this c_move (negative) don't works:

Code:
c_move(me,vector(-1,0,0),vector(0,0,-dist_down),IGNORE_PASSABLE | GLIDE); // move the player


While this is working:
Code:
c_move(me,vector(1,0,0),vector(0,0,-dist_down),IGNORE_PASSABLE | GLIDE); // move the player


only difference is the minus, (the model should walk without using keys)

Re: c_move in negative area [Re: IngoP] #386328
11/01/11 17:43
11/01/11 17:43
Joined: Oct 2011
Posts: 4
Germany
I
IngoP Offline OP
Guest
IngoP  Offline OP
Guest
I

Joined: Oct 2011
Posts: 4
Germany
could no one help me?

Re: c_move in negative area [Re: IngoP] #386330
11/01/11 18:13
11/01/11 18:13
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Upload a small demo.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends

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