User Tools

Site Tools


en:guides:beginners:physics

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:physics [2018/02/14 04:47 (9 months ago)]
iarwain ↷ Links adapted because of a move operation
en:guides:beginners:physics [2018/06/28 03:48 (5 months ago)] (current)
sausage In line with init projects
Line 18: Line 18:
 [HeroObject] [HeroObject]
 Graphic ​     = HeroGraphic Graphic ​     = HeroGraphic
-Position ​    = (50400, 0)+Position ​    = (-350100, 0)
 Scale        = 2 Scale        = 2
 AnimationSet = HeroAnimationSet AnimationSet = HeroAnimationSet
Line 40: Line 40:
 </​code>​ </​code>​
  
-The type is box and that means the collision area is a box shape surrounding the object. The part is also set to solid. That means that the object will not be able to pass through other solid body parts.+The type is ''​box'' ​and that means the collision area is a box shape surrounding the object. The part is also set to solid. That means that the object will not be able to pass through other solid body parts.
  
 Run that and you'll see our hero fall right through the floor. So that's good. The physics body is working. But we need to get the platforms solid too. Run that and you'll see our hero fall right through the floor. So that's good. The physics body is working. But we need to get the platforms solid too.
Line 47: Line 47:
 [PlatformObject] [PlatformObject]
 Graphic ​ = PlatformGraphic Graphic ​ = PlatformGraphic
-Position = (0570, 0)+Position = (-400270, 0)
 Scale    = (54, 2, 0) Scale    = (54, 2, 0)
 Repeat ​  = (27, 1, 0) Repeat ​  = (27, 1, 0)
Line 65: Line 65:
 </​code>​ </​code>​
  
-Notice the slight difference from the hero body. The PlatformBody is not dynamic, so it won't be affected by gravity. But the PlatformBodyPart is set to solid. This will allow the hero to collide with the platform without it falling away.+Notice the slight difference from the ''​HeroBody''? ​The ''​PlatformBody'' ​is not dynamic, so it won't be affected by gravity. But the ''​PlatformBodyPart'' ​is set to solid. This will allow the hero to collide with the platform without it falling away.
  
-But the two won't affect each other until you set collision flags.+//But the two won't affect each other until you set collision flags.//
  
 First, set the flags on the HeroBodyPart:​ First, set the flags on the HeroBodyPart:​
Line 79: Line 79:
 </​code>​ </​code>​
  
-The SelfFlags is a string that descibes ​the object and the CheckMask is a mask list of other object ​SelfFlags ​it can collide with.+The ''​SelfFlags''​ property ​is a string that describes ​the object and the ''​CheckMask'' ​is a mask list of other object ​self flags it can collide with.
  
-Now set the PlatformBodyPart flags:+Now set the ''​PlatformBodyPart'' ​flags:
  
 <​code=ini>​ <​code=ini>​
Line 95: Line 95:
 Run the game and our hero will land and stay on the floor. Run the game and our hero will land and stay on the floor.
  
-But he kind of hangs into the floor. ​What's happening here? Turn on the physics debug to see why:+Our guy lands and stays on the floor. ​Good.  
 + 
 +You can turn on physics debug mode if you want to see the bounding boxes around the objects. Turn on the physics debug with:
  
 <​code=ini>​ <​code=ini>​
Line 104: Line 106:
 </​code>​ </​code>​
  
-You can see the boxes that surround the bodiesThe hero's object ​is off-centre with his body. The graphic for the hero has a centered pivot, and our animation set needs to have the same: +You can see the boxes that surround the hero and platformsThat is because they have bodies.
- +
-<​code=ini>​ +
-[HeroAnimationSet] +
-Texture ​  = soldier_full.png +
-Pivot     = center +
-FrameSize = (32, 32, 0) +
-StartAnim = HeroRun +
-HeroRun ​  = 6  +
-</​code>​ +
- +
-<WRAP center round tip 60%> +
-The step above may not be required. Needs to be checked. +
-</​WRAP>​ +
  
 Run that up and you should get the following: Run that up and you should get the following:
en/guides/beginners/physics.txt · Last modified: 2018/06/28 03:48 (5 months ago) by sausage