This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| en:guides:beginners:exploding_monsters [2018/02/14 04:47 (8 years ago)] – ↷ Page moved from guides:beginners:exploding_monsters to en:guides:beginners:exploding_monsters iarwain | en:guides:beginners:exploding_monsters [2025/09/30 17:26 (8 weeks ago)] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 5: | Line 5: | ||
| {{ : | {{ : | ||
| - | Right click and save this image into the data/anim folder as " | + | Right click and save this image into the '' |
| Every monster will explode into several of these jelly objects when shot. | Every monster will explode into several of these jelly objects when shot. | ||
| Line 19: | Line 19: | ||
| </ | </ | ||
| - | Then an individual JellyObject: | + | Then an individual |
| < | < | ||
| Line 26: | Line 26: | ||
| AnimationSet = JellyAnimationSet | AnimationSet = JellyAnimationSet | ||
| Speed = (-50, -50, 0) ~ (50, -50, 0) | Speed = (-50, -50, 0) ~ (50, -50, 0) | ||
| - | Position | + | Position |
| Body = JellyBody | Body = JellyBody | ||
| </ | </ | ||
| Line 43: | Line 43: | ||
| [JellyWobbleAnim] | [JellyWobbleAnim] | ||
| - | KeyDuration = 0.05 | + | KeyDuration = 0.08 |
| </ | </ | ||
| - | Then the jelly needs a body. This is so the bits will bounce nicely over the platforms: | + | The jelly needs a body. This is so the bits will bounce nicely over the platforms: |
| < | < | ||
| Line 62: | Line 62: | ||
| </ | </ | ||
| - | Then let the platforms know about the jelly mask: | + | Then let the platforms know about the jelly, by adding it the platform' |
| - | < | + | < |
| [PlatformBodyPart] | [PlatformBodyPart] | ||
| Type = box | Type = box | ||
| Line 74: | Line 74: | ||
| Test it by adding a JellyObject to the Scene section: | Test it by adding a JellyObject to the Scene section: | ||
| - | < | + | < |
| [Scene] | [Scene] | ||
| ChildList = PlatformObject # MiddlePlatformObject # | ChildList = PlatformObject # MiddlePlatformObject # | ||
| Line 88: | Line 88: | ||
| - | That's not bad, but really... the animation frame setup isn't quite what we're after. In our '' | + | That's not bad, but really... the animation frame setup isn't quite what we're after. In our '' |
| * Frame 1 | * Frame 1 | ||
| Line 95: | Line 95: | ||
| * Frame 3 | * Frame 3 | ||
| - | That is how the animation should be. Thankfully Orx will let us specify the frames for an animation manually. Add the following config to set this up: | + | That is how the animation should be. Thankfully Orx will let us specify the third and fourth |
| < | < | ||
| - | [JellyWobbleAnim0003] | + | [JellyWobbleAnim3] |
| TextureOrigin = (0, 0, 0) | TextureOrigin = (0, 0, 0) | ||
| - | [JellyWobbleAnim0004] | + | [JellyWobbleAnim4] |
| TextureOrigin = (64, 0, 0) | TextureOrigin = (64, 0, 0) | ||
| </ | </ | ||
| - | Great. By using the name of the animation ('' | + | Great. By using the name of the animation ('' |
| - | The next step is to create an explosion object. This will be an empty object that contains a spawner. The spawner will shoot out five jellys. These explosion objects can be placed on any monster for dramatic effect: | + | The next step is to create an explosion object. This will be an empty object that contains a spawner. The spawner will shoot out five jellies. These explosion objects can be placed on any monster for dramatic effect: |
| < | < | ||
| Line 122: | Line 122: | ||
| To test one of the these, remove the JellyObject from the Scene section and add the JellyExploder instead: | To test one of the these, remove the JellyObject from the Scene section and add the JellyExploder instead: | ||
| - | < | + | < |
| [Scene] | [Scene] | ||
| ChildList = PlatformObject # MiddlePlatformObject # | ChildList = PlatformObject # MiddlePlatformObject # | ||
| Line 137: | Line 137: | ||
| Great, we see a bunch of jelly blobs appear. Remove the JellyExploder from the Scene selector: | Great, we see a bunch of jelly blobs appear. Remove the JellyExploder from the Scene selector: | ||
| - | < | + | < |
| [Scene] | [Scene] | ||
| ChildList = PlatformObject # MiddlePlatformObject # | ChildList = PlatformObject # MiddlePlatformObject # | ||
| Line 146: | Line 146: | ||
| </ | </ | ||
| - | Also remove the Position parameter from the JellyObject because these will soon be dynamically placed. Also change the Speed parameter to be more dramatic: | + | Also remove the '' |
| < | < | ||
| Line 158: | Line 158: | ||
| Next, we need to ensure that the BulletObject has a body and that it can collide with a monster: | Next, we need to ensure that the BulletObject has a body and that it can collide with a monster: | ||
| - | < | + | < |
| [BulletObject] | [BulletObject] | ||
| Graphic | Graphic | ||
| Line 164: | Line 164: | ||
| Scale = 0.25 | Scale = 0.25 | ||
| Body = BulletBody | Body = BulletBody | ||
| + | |||
| [BulletBody] | [BulletBody] | ||
| Line 176: | Line 177: | ||
| </ | </ | ||
| - | The bullets are not affected by gravity (Dynamic) nor do they bounce off other objects (Solid). | + | The bullets are not affected by gravity (not Dynamic) nor do they bounce off other objects (not Solid). |
| In order to make a monster explode, we can make a function in the code which will create a exploder object on top off a monster object, and then destroy the monster itself: | In order to make a monster explode, we can make a function in the code which will create a exploder object on top off a monster object, and then destroy the monster itself: | ||
| Line 196: | Line 197: | ||
| </ | </ | ||
| - | We are passing in a named exploderObjectName so that we can use this function later for other exploders we'll make. | + | We are passing in a named exploderObjectName so that we can re-use this function later for other exploders we'll make. |
| Now to use it. In the physics event, add a check for collision between a bullet and a monster and process it: | Now to use it. In the physics event, add a check for collision between a bullet and a monster and process it: | ||
| - | < | + | < |
| + | if (orxString_Compare(recipientObjectName, | ||
| + | orxObject_SetLifeTime(pstRecipientObject, | ||
| + | } | ||
| + | | ||
| if (orxString_Compare(senderObjectName, | if (orxString_Compare(senderObjectName, | ||
| CreateExplosionAtObject(pstRecipientObject, | CreateExplosionAtObject(pstRecipientObject, | ||
| Line 215: | Line 220: | ||
| </ | </ | ||
| - | So in both cases, create the JellyExplosion on top of a monster, then destroy both the monster and the bullet that hit it. | + | So in both cases, create the '' |
| Compile and run. You'll get some crazy jelly action all over the screen: | Compile and run. You'll get some crazy jelly action all over the screen: | ||
| Line 221: | Line 226: | ||
| {{: | {{: | ||
| - | The jelly blobs never dissapear. Fix that by giving it a specific lifetime: | + | The jelly blobs never disappear. Fix that by giving it a specific lifetime: |
| - | < | + | < |
| [JellyObject] | [JellyObject] | ||
| Graphic | Graphic | ||
| Line 234: | Line 239: | ||
| ---- | ---- | ||
| - | Next: Part 19 - [[guides: | + | Next: Part 19 - [[en:guides: |
| - | {{section> | + | {{section> |