This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:tutorials:spawners:electrical_sparks [2018/02/13 20:46 (7 years ago)] – ↷ Page moved from tutorials:spawners:electrical_sparks to en:tutorials:spawners:electrical_sparks iarwain | en:tutorials:spawners:electrical_sparks [2024/06/13 20:08 (10 months ago)] (current) – [Setting up Input] Fix the input section name to match the default in a fresh init project hcarty | ||
---|---|---|---|
Line 69: | Line 69: | ||
See the comments in the config above to see what part each FX plays on the particles. | See the comments in the config above to see what part each FX plays on the particles. | ||
+ | |||
+ | ===== A spark graphic ===== | ||
+ | |||
+ | Any small object will do, even a dot. But you can try this little object if you wish: | ||
+ | |||
+ | <WRAP center round box 60%> | ||
+ | {{ tutorials: | ||
+ | </ | ||
+ | |||
===== Setting up Input ===== | ===== Setting up Input ===== | ||
Line 83: | Line 92: | ||
<code c> | <code c> | ||
- | orxSTATUS orxFASTCALL InputEventHandler(const orxEVENT *_pstEvent) | + | orxSTATUS orxFASTCALL InputEventHandler(const orxEVENT *_pstEvent) |
- | + | { | |
- | if(orxInput_IsActive(" | + | if(orxInput_HasBeenActivated(" |
- | orxVECTOR | + | { |
- | orxVECTOR | + | orxVECTOR mousePosition; |
+ | |||
+ | orxMouse_GetPosition(&mousePosition); | ||
+ | orxRender_GetWorldPosition(&mousePosition, | ||
+ | |||
+ | orxOBJECT *sparks = orxObject_CreateFromConfig("Sparks"); | ||
+ | if (sparks) | ||
+ | | ||
+ | orxVECTOR | ||
+ | orxObject_GetPosition(sparks, & | ||
+ | |||
+ | | ||
+ | sparksPosition.fY = mousePosition.fY; | ||
- | orxMouse_GetPosition(& | + | orxObject_SetPosition(sparks, & |
- | + | } | |
- | orxOBJECT *sparks = orxObject_CreateFromConfig(" | + | } |
- | orxObject_GetPosition(sparks, & | + | |
- | sparksPosition.fX = mousePosition.fX; | ||
- | sparksPosition.fY = mousePosition.fY; | ||
- | |||
- | orxObject_SetPosition(sparks, | ||
- | } | ||
- | |||
return orxSTATUS_SUCCESS; | return orxSTATUS_SUCCESS; | ||
} | } | ||
Line 107: | Line 121: | ||
<code ini> | <code ini> | ||
- | [KeysForInput] | + | [Input] |
KEY_ESCAPE | KEY_ESCAPE | ||
MOUSE_LEFT | MOUSE_LEFT |