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/05/27 08:52 (7 years ago)] – sausage | 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 75: | Line 75: | ||
<WRAP center round box 60%> | <WRAP center round box 60%> | ||
- | {{ :en:tutorials: | + | {{ tutorials: |
</ | </ | ||
Line 92: | 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 mousePosition | + | |
- | orxVECTOR sparksPosition = { 0,0,0 }; | + | orxVECTOR mousePosition; |
- | orxMouse_GetPosition(& | + | |
- | + | | |
- | orxOBJECT *sparks = orxObject_CreateFromConfig(" | + | |
- | orxObject_GetPosition(sparks, | + | orxOBJECT *sparks = orxObject_CreateFromConfig(" |
+ | if (sparks) | ||
+ | { | ||
+ | orxVECTOR sparksPosition; | ||
+ | | ||
+ | |||
+ | sparksPosition.fX = mousePosition.fX; | ||
+ | sparksPosition.fY = mousePosition.fY; | ||
+ | |||
+ | orxObject_SetPosition(sparks, | ||
+ | } | ||
+ | } | ||
- | sparksPosition.fX = mousePosition.fX; | ||
- | sparksPosition.fY = mousePosition.fY; | ||
- | |||
- | orxObject_SetPosition(sparks, | ||
- | } | ||
- | |||
return orxSTATUS_SUCCESS; | return orxSTATUS_SUCCESS; | ||
} | } | ||
Line 116: | Line 121: | ||
<code ini> | <code ini> | ||
- | [KeysForInput] | + | [Input] |
KEY_ESCAPE | KEY_ESCAPE | ||
MOUSE_LEFT | MOUSE_LEFT |