User Tools

Site Tools


en:tutorials:spawners:electrical_sparks

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next 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 iarwainen:tutorials:spawners:electrical_sparks [2024/06/13 20:08 (4 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:spawners:spark.png |}}
 +</WRAP>
 +
  
 ===== 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("Click") && orxInput_HasNewStatus("Click")) { +    if(orxInput_HasBeenActivated("Click")
- orxVECTOR mousePosition = { 0,0,0 }+    { 
- orxVECTOR sparksPosition = { 0,0,0 };+        orxVECTOR mousePosition; 
 + 
 +        orxMouse_GetPosition(&mousePosition); 
 +        orxRender_GetWorldPosition(&mousePosition, orxNULL, &mousePosition); 
 + 
 +        orxOBJECT *sparks = orxObject_CreateFromConfig("Sparks")
 +        if (sparks) 
 +        
 +            orxVECTOR sparksPosition; 
 +            orxObject_GetPosition(sparks&sparksPosition)
 + 
 +            sparksPosition.fX mousePosition.fX; 
 +            sparksPosition.fY = mousePosition.fY;
  
- orxMouse_GetPosition(&mousePosition); +            orxObject_SetPosition(sparks, &sparksPosition); 
-  +        } 
- orxOBJECT *sparks = orxObject_CreateFromConfig("Sparks"); +    }
- orxObject_GetPosition(sparks, &sparksPosition);+
  
- sparksPosition.fX = mousePosition.fX; 
- sparksPosition.fY = mousePosition.fY; 
-  
- orxObject_SetPosition(sparks, &sparksPosition); 
- } 
-  
     return orxSTATUS_SUCCESS;     return orxSTATUS_SUCCESS;
 } }
Line 107: Line 121:
  
 <code ini> <code ini>
-[KeysForInput]+[Input]
 KEY_ESCAPE      = Quit KEY_ESCAPE      = Quit
 MOUSE_LEFT      = Click MOUSE_LEFT      = Click
en/tutorials/spawners/electrical_sparks.1518583582.txt.gz · Last modified: 2018/02/14 00:46 (7 years ago) (external edit)