Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
summer_2019:making_objects_move [2019/07/31 22:15]
wellerd
summer_2019:making_objects_move [2019/07/31 22:32]
wellerd
Line 1: Line 1:
-===== Snowman ​Activity: Making ​and Placing Shapes ​in Glowscript =====+===== Activity: Making ​Objects Move in Glowscript =====
  
 **Follow this link for the activity: [[https://​trinket.io/​glowscript/​cf9c7047b3|link]]** **Follow this link for the activity: [[https://​trinket.io/​glowscript/​cf9c7047b3|link]]**
Line 7: Line 7:
 {{:​summer_2019:​1d_motion.png?​800|}} {{:​summer_2019:​1d_motion.png?​800|}}
  
-  ​Try running the code, rotating the viewing window, and zooming in and out.+  ​Try running the code, rotating the viewing window, and zooming in and out.
  
-  ​Try running the code after each of the following steps to observe the change that arises from adding/​editing the code. +  ​Try running the code after each of the following steps to observe the change that arises from adding/​editing the code.
- +
-Line 27: Add code to update the position of the particle based on its velocity+
  
 +  * **Line 27:** Add code to update the position of the particle based on its velocity.
  
 +<​code>​
 particle.pos = particle.pos + particle.velocity*dt particle.pos = particle.pos + particle.velocity*dt
 +</​code>​
 +
 +  * **Line 7:** Edit the code to change the particle velocity to 4 in the x-direction.
  
-Line 7: Edit the code to change the particle velocity to 4 in the x-direction+<code>
 particle.velocity = vector(4,​0,​0) particle.velocity = vector(4,​0,​0)
 +</​code>​
  
-Line 10: Edit the code to change the particle acceleration to -1 in the x-direction.+  * **Line 10:** Edit the code to change the particle acceleration to -1 in the x-direction.
  
-Line 30: Add code to update the velocity of the particle based on its acceleration. +  * **Line 30:** Add code to update the velocity of the particle based on its acceleration. ​//Hint: Try to mimic line 27, but use “velocity” and “acceleration” instead of “pos” and “velocity”,​ respectively.//
-Hint: Try to mimic line 27, but use “velocity” and “acceleration” instead of “pos” and “velocity”,​ respectively.+
  
-Line 22: Edit the code to get the particle to stop when its velocity is equal to 0 +  * **Line 22:** Edit the code to get the particle to stop when its velocity is equal to 0. //Hint: Make the while statement depend on particle.velocity.x//
-Hint: Make the while statement depend on particle.velocity.x+
  • summer_2019/making_objects_move.txt
  • Last modified: 2019/07/31 22:59
  • by wellerd