Task
Completing the GHW Games challenge - Hand Gesture game - Non-traditional Input Game
What it does
A user can play Rabbit Jump using their hands - video sensing.
How we built it
I've built it on Scratch, using their Video Sensing extension.
Added simple sprites such as a rabbit, trees, and a ground.
For rabbit there are two scripts. First one starts when the game starts. It initiates by positioning the rabbit at (-150, -68), initial rabbit costume (animation frame) as the first costume, turning on the video, setting video transparency. Now define the animation and gravity for rabbit, along with game over condition, as below algorithm.
// rabbit - script 1
Game starts // Starting point
Position rabbit as (-150, -68)
Switch the costume to 1
Turn on video and set transparency to 50
Initialize score as 0
Initialize costume value // used later to switch between 1 and 2
Broadcast and display a instruction message
While the rabbit is not touching a tree:
If rabbit is grounded:
Switch the costumes between 1 and 2 every 0.3 seconds
If the rabbit is above a certain y-axis value:
While the rabbit is not grounded:
Slowly reduce y axis of rabbit.
Switch costume to 4
Set the y-axis to value of rabbit -68
Switch costume to 1
Stop all OTHER rabbit scripts
Broadcast and display a game over message
Turn off video
Stop ALL scripts
Now in another script define how to make rabbit jump
// rabbit - script 2
If video motion over rabbit > 50:
Switch to costume 3
Make rabbit slowly jump to a certain height
Wait for a second
Now create a script for tree to clone itself in a certain interval.
// tree - script 1
Broadcast for game instruction received // Starting point
Hide the tree sprite
Create a clone of itself
While true: // forever
Wait for a random time between 2 to 5 seconds
Create a clone of itself
Define the movement of tree in another script.
// tree - script 2
When a clone is created
Initialize position as (215, -68)
Show the sprite
While tree not touching screen edges:
Slowly move the tree to the left
If tree crosses x position of rabbit:
Increment score
Delete the clone
Stop all scripts when game over.
// tree - script 3
When Game Over broadcast broadcast is received
Stop all tree scripts
Challenges we ran into
Trying to make this video sensing work.
Built With
- scratch
Log in or sign up for Devpost to join the conversation.