0% found this document useful (0 votes)
90 views2 pages

Math Jenga Script

The document describes a Jenga-style math game that represents math skills and concepts as stacks of blocks. Individual blocks store data on math standards and can be highlighted for information. The game uses prefabs, scripts and JSON data to build and manage block stacks for different grade levels and allow camera control and block interaction through clicking.

Uploaded by

Scribgsd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
90 views2 pages

Math Jenga Script

The document describes a Jenga-style math game that represents math skills and concepts as stacks of blocks. Individual blocks store data on math standards and can be highlighted for information. The game uses prefabs, scripts and JSON data to build and manage block stacks for different grade levels and allow camera control and block interaction through clicking.

Uploaded by

Scribgsd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

Math Jenga builds stacks of blocks representing individual math lessons learned in

Middle School, with their fragility corresponding to mastery of said skills. The
Jenga model is to visualize this in a game engine.

The core of the architecture for this short demo is the Math Block Manager, which
sits in an empty scene object.

[End Play, show script, expand]


It uses an enum to differentiate block types from the imported data, and holds
public variables import the JSON from API, highlight blocks and display info from
said JSON, and to build the scene's jenga stacks for 6th, 7th, and 8th grade.

[Show gameobject in inspector]


These serialized fields need to be stocked in the scene with their components in
the game scene to work correctly.

[Show X Grade prefab]


The prefabs for the stacks are simply empty objects with a 3D text element childed
to them.

[Show prefab block]


The prefab blocks have a tag to quickly differentiate them via sorting, a component
to track their deserialized data from the API, and a rigidbody component to
simulate gravity. They also have a custom material for ease of visual
identification. Their dimensions are scaled down from the standard of 1.5 CM by 2.5
CM by 7.5 CM

[Show MathBlockManager script again]


Start initializes by making a mapping table via dictionary for prefabs representing
the blocks to be used, deserializing JSON from the API via its URL, and using a
function to build stacks of prefabs with that data.
[Run the game to demonstrate]

Update uses the screen cursor to highlight blocks, swapping out their material on
the fly and updating the UI based on the info deserialized to their component
scripts.
[Highlight to show off]
The deserialized data itself is stored in MathBlockData.
[Show MathBlockData script]

[Switch back to MathBlockManager]


The blocks that are created are sorted before spawning using LINQ to be in
ascending order first by grade - which is used for individual stack creation - then
by domain, cluster, and standard id.

The stack creation goes in an alternating sequence of 6 - 3 in a row vertically,


going up 1, then 3 horizontally, going up 1 again, and looping back over from
there.

As a personal touch, I decided to have the block instances spawn with minute
alterations in their scale - this is to simulate actual jenga blocks, which have
tiny, random variations from the standard dimensions which lead to the stacks more
easily toppling. Their deserialized data is assigned to a component at this point
as well.
[Show MathBlockComponent]

[Show OrbitOnClick]
Controlling the Camera by comparison has a very simple pair of controllers - one to
rotate around a stack on clicks with right click
[Show SwapCameraFocus]
And another to Swap the Camera Focus, which is the empty game object the camera
orbits around. You can switch down the line with the Q and E keys.
[Show UI instructions]
And all this is in the game UI on the upper left, so the user knows right off what
to do
[Click on Main Camera in scene hierarchy]
Another personal touch I did here was also attach the 3D text for stack grades to
the same Orbiting script.
[Demonstrate camera controls]
This makes the grade texts follow the camera rotation no matter where they are.

[Click on TestMyStack script]


Lastly, the first gameplay mode, Test My Stack, takes advantage of the ground work
already laid. All it does is delete the glass blocks from the scene, identified by
their prefab's tag, and turn on gravity for wood and stone blocks.
[Demonstrate clicking on Test My Stack]

And that's it! More game types, such as Strengthen My Stack, Earthquake, Build My
Stack, and Challenge can be added on with additional buttons and building off the
existing prefabs.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy