User Tools

Site Tools


en:guides:beginners:changing_direction

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
en:guides:beginners:changing_direction [2018/02/14 04:47 (9 months ago)]
iarwain ↷ Links adapted because of a move operation
en:guides:beginners:changing_direction [2018/06/28 11:45 (5 months ago)] (current)
sausage In line with init projects
Line 28: Line 28:
 The orxObject_SetScale function is being used here instead of the usual orxObject_SetFlip. The latter does not flip child objects or body positions, but scale does. We will need this later when our hero has a child gun object. The orxObject_SetScale function is being used here instead of the usual orxObject_SetFlip. The latter does not flip child objects or body positions, but scale does. We will need this later when our hero has a child gun object.
  
-Notice that we need to restore ​the flip when the right key is pressed.+Compile and Run. We can run left and right and the flipping is correct. But... there is a huge gap when the hero switches directions.
  
-Finally, ​ensure the pivot for our hero's graphic and animation set are both centered so that when we flip left and right, there won't be any issues with the physically body shifting incorrectly:​+Therefore we need to ensure the pivot for our hero's graphic and animation set are both centered so that when we flip left and right, there won't be any issues with the physically body shifting incorrectly:​
  
 <​code=ini>​ <​code=ini>​
Line 40: Line 40:
  
 [HeroAnimationSet] [HeroAnimationSet]
-Texture = soldier_full.png +Texture ​   = soldier_full.png 
-FrameSize = (32, 32, 0) +FrameSize ​ = (32, 32, 0) 
-HeroRun = 6 +HeroRun ​   = 6 
-HeroIdle = 1 +HeroIdle ​  ​= 1 
-StartAnim = HeroIdle+StartAnim ​ = HeroIdle
 HeroIdle->​ = HeroIdle # .HeroRun HeroIdle->​ = HeroIdle # .HeroRun
-HeroRun->​ = HeroRun # HeroIdle +HeroRun-> ​ = HeroRun # HeroIdle 
-Pivot          = center+Pivot      = center
 </​code>​ </​code>​
  
  
-Compile and run. We can run left and right. That should be working ​well, our hero can now run left and right, or stand idle either left or right.+Compile and run. That should be working ​much better. Our hero can run left and right, or stand idle either left or right.
  
 ---- ----
en/guides/beginners/changing_direction.txt · Last modified: 2018/06/28 11:45 (5 months ago) by sausage