This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
guides:beginners:survival [2015/10/24 02:59 (9 years ago)] – created sausage | en:guides:beginners:survival [2021/10/09 21:49 (3 years ago)] (current) – Fixed texture filename iarwain | ||
---|---|---|---|
Line 3: | Line 3: | ||
Keeping alive is key in a platformer. The monsters need to be a threat to our hero. If a monster touches our hero, he should explode in a shower of bits. That's game over. | Keeping alive is key in a platformer. The monsters need to be a threat to our hero. If a monster touches our hero, he should explode in a shower of bits. That's game over. | ||
- | For the explosion for our hero, let's use this object | + | For the explosion for our hero, let's use this object |
- | {{ : | + | {{ : |
Might seem an odd choice, but if 50 of these spawned over the hero in various stages of rotation and flew in several directions like sparks, it will be fairly effective. Start with the object and the graphic: | Might seem an odd choice, but if 50 of these spawned over the hero in various stages of rotation and flew in several directions like sparks, it will be fairly effective. Start with the object and the graphic: | ||
Line 11: | Line 11: | ||
< | < | ||
[SparkGraphic] | [SparkGraphic] | ||
- | Texture = +.png | + | Texture = plus.png |
Pivot = center | Pivot = center | ||
Line 24: | Line 24: | ||
</ | </ | ||
- | Each SparkObject will fly up and out in a random direction, random colours, sizes, and a random lifetime. 50 at a time should look good. Next, make a body for it so that it will fall back to earth: | + | Each '' |
< | < | ||
Line 38: | Line 38: | ||
A pretty simple body and part - affected by gravity but not set to collide with anything. | A pretty simple body and part - affected by gravity but not set to collide with anything. | ||
- | Finally, we'll make an empty hero exploer | + | <WRAP center round tip 80%> |
+ | Note that giving each particle a body is an easy way to make objects fall to the ground, but it is also heavy and in-efficient. While we won't do it in this guide, an FX can also be a cheap way to make object fall down. See this tutorial if you would like to learn how: [[en: | ||
+ | </ | ||
+ | |||
+ | Finally, we'll make an empty hero exploder | ||
< | < | ||
Line 61: | Line 65: | ||
</ | </ | ||
- | Now to handle it in code: | + | Now to handle it in code, by adding the following at the bottom of the '' |
< | < | ||
Line 67: | Line 71: | ||
orxString_Compare(senderObjectName, | orxString_Compare(senderObjectName, | ||
){ | ){ | ||
- | CreateExplosionAtObject(pstSenderObject, " | + | CreateExplosionAtObject(pstRecipientObject, " |
orxObject_SetLifeTime(pstSenderObject, | orxObject_SetLifeTime(pstSenderObject, | ||
orxObject_Enable(pstRecipientObject, | orxObject_Enable(pstRecipientObject, | ||
Line 75: | Line 79: | ||
orxString_Compare(recipientObjectName, | orxString_Compare(recipientObjectName, | ||
){ | ){ | ||
- | CreateExplosionAtObject(pstRecipientObject, " | + | CreateExplosionAtObject(pstSenderObject, " |
- | orxObject_SetLifeTime(pstSenderObject, 0); | + | orxObject_SetLifeTime(pstRecipientObject, 0); |
orxObject_Enable(pstSenderObject, | orxObject_Enable(pstSenderObject, | ||
} | } | ||
</ | </ | ||
- | So if the hero and the monster touch, disable the hero and place a HeroExploder on top of him. | + | So if the hero and the monster touch, disable the hero and place a '' |
Compile and run it: | Compile and run it: | ||
- | {{: | + | {{: |
So there you go. The major elements of the game are now complete. Well done! | So there you go. The major elements of the game are now complete. Well done! | ||
In our next and last chapter, we'll do a few housekeeping changes to flesh the game out. | In our next and last chapter, we'll do a few housekeeping changes to flesh the game out. | ||
+ | |||
+ | ---- | ||
+ | Next: [[en: | ||
+ | |||
+ | {{section> |