byako Shogun
 
 
  
  Joined: 28 Oct 2003 Posts: 48 Location: Shotgun in the 48 car...
  | 
		
			
				 Posted: Mon Dec 15, 2003 11:40 pm    Post subject: diagonal walking missaligns hero walkabout gfx | 
				     | 
			 
			
				
  | 
			 
			
				I have a script that I use for multi directional movement (not just the standard n,s,e,w directions)   
 
 
The problem is, sometimes the walkabout becomes missaligned (both north-south & left-right)   
 
 
I can't seem to fix it.   
 
 
#begin script----------------------
 
script,Diagonalwalk,begin
 
#   variable(upkeypad)
 
#   variable(downkeypad)
 
  variable (pass,move)
 
  variable (HXX,HYY)
 
  set tag ( 10, true )
 
#      setheroz(me,5) #attempt at manually resetting after each step
 
#      setheroz(1,5)
 
#      setheroz(2,5)
 
#      setheroz(3,5)
 
  while ( checktag ( 10 ) ) do
 
  (
 
    set variable( move, 1 )
 
 
    wait for key (anykey )
 
    while ( key is pressed ( 73 ),and,move) #walk northeast
 
    do,begin 
 
      set variable(pass,read pass block(hero X(me)+1,hero Y(me)--1))
 
      if (pass,and,harm tile)
 
      then,begin ( set variable( move, 0 ) ) end
 
      else, begin
 
        suspendherowalls
 
        walk hero ( me, right, 1 )
 
        walk hero ( me, up, 1 )
 
        wait for hero ( me )
 
        resumeherowalls
 
      end #end else
 
    end #end while/do walk northeast
 
    set variable( move, 1 )
 
    wait for key (anykey )
 
    while ( key is pressed (79),and,move )#walk southwest
 
    do,begin
 
      setvariable(HXX,(herox(me)--1)*20) #math for exact pixel location
 
      setvariable(HYY,(heroy(me)+1)*20)
 
      set variable(pass,read pass block(hero X(me)--1,hero Y(me)+1))
 
      if (pass,and,harm tile)
 
      then,begin ( set variable( move, 0 ) ) end
 
      else, begin
 
#        while ( herox <> HXX, and, heroy <> HYY ) do, begin #this locks up the script, so I disabled it
 
#it is supposed to check the current pixel placement of the hero 
 
#versus the destination, and stop when they match          
 
suspendherowalls
 
        walk hero ( me, left, 1 )
 
        walk hero ( me, down, 1 )
 
        wait for hero ( me )
 
#        puthero(me,hxx,hyy) #this by itself caused the hero to 'jump' suddenly to a new place          
 
resumeherowalls
 
#        end #end of unused while
 
      end #end else
 
    end #end while/do walk southwest
 
  )
 
end
 
#Script over------------------------------
 
 
as you can see, I have an attempt at direct pixel placement to realign the hero after each step(the hxx,hyy variables), but all that accomplished was making the heros suddenly jump to a new location periodically.
 
 
I also have tried to use setheroz(who,5) to reset the vertical alignment, to no avail. I have tried other locations in the script, for those commands as well, but no luck yet.
 
 
any ideas? _________________ This is my new signature.
 
---------------------
 
EDO   -an oldie but goodie
 
matricx re-hacked a great little game | 
			 
		  |