User Tools

Site Tools


en:tutorials:orxscroll:binding-orxscroll

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:orxscroll:binding-orxscroll [2024/05/05 17:13 (11 months ago)] – Update to support analog input for Hero class hcartyen:tutorials:orxscroll:binding-orxscroll [2024/05/06 18:10 (11 months ago)] (current) – Update to match project renaming from binding-of-objects to BindingOfObjects hcarty
Line 42: Line 42:
 <hidden> <hidden>
 <code ini> <code ini>
-binding-of-objects - Template basic config file+BindingOfObjects - Template basic config file
  
 [Display] [Display]
Line 57: Line 57:
  
 [Resource] [Resource]
-Texture         = bundle: # bundle:binding-of-objects.obr # ../data/texture +Texture         = bundle: # bundle:BindingOfObjects.obr # ../data/texture 
-Sound           = bundle: # bundle:binding-of-objects.obr # ../data/sound+Sound           = bundle: # bundle:BindingOfObjects.obr # ../data/sound
  
 [Input] [Input]
Line 204: Line 204:
 { {
   // Set initial movement direction   // Set initial movement direction
-  m_direction = Direction::SOUTH;+  m_direction = SOUTH;
   // Get movement speed from config value   // Get movement speed from config value
   m_movementSpeed = orxConfig_GetFloat("MovementSpeed");   m_movementSpeed = orxConfig_GetFloat("MovementSpeed");
Line 261: Line 261:
     m_timeSinceDirectionChange = 0;     m_timeSinceDirectionChange = 0;
     // Pick random number between bounds of Direction enum     // Pick random number between bounds of Direction enum
-    orxU32 randomNum = orxMath_GetRandomU32(0, static_cast<orxU32>(Direction::LAST));+    orxU32 randomNum = orxMath_GetRandomU32(0, static_cast<orxU32>(LAST));
     // Update object's direction of movement     // Update object's direction of movement
     m_direction = static_cast<Direction>(randomNum);     m_direction = static_cast<Direction>(randomNum);
Line 297: Line 297:
 </code> </code>
  
-Add the following lines to ''binding_of_objects::BindObjects'' in ''binding-of-objects.cpp'' after the line for ''"Object"'':+Add the following lines to ''binding_of_objects::BindObjects'' in ''BindingOfObjects.cpp'' after the line for ''"Object"'':
  
 <code c> <code c>
Line 387: Line 387:
 The code should be almost self-explanatory. The hero's movement speed will be pulled from its config value. The update function (called every frame) sets the speed of the character based on what keyboard arrow is pressed. The ''OnCollide'' function adds a "flash" effect to the character. The code should be almost self-explanatory. The hero's movement speed will be pulled from its config value. The update function (called every frame) sets the speed of the character based on what keyboard arrow is pressed. The ''OnCollide'' function adds a "flash" effect to the character.
  
-You have to modify the ''binding_of_objects::BindObjects'' function to make it bind the new ''Hero'' class to the ''O-Hero'' object. Otherwise, the Hero will not be bound to its class and will just stand still in the middle of the screen!+You have to modify the ''BindingOfObjects::BindObjects'' function to make it bind the new ''Hero'' class to the ''O-Hero'' object. Otherwise, the Hero will not be bound to its class and will just stand still in the middle of the screen!
  
 Try to do those things yourself. If you need help, though, here are the lines to add: Try to do those things yourself. If you need help, though, here are the lines to add:
en/tutorials/orxscroll/binding-orxscroll.1714954412.txt.gz · Last modified: 2024/05/05 17:13 (11 months ago) by hcarty