Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Design Innovative Robots with LEGO SPIKE Prime

You're reading from   Design Innovative Robots with LEGO SPIKE Prime Seven creative STEM robotic designs to challenge your mind

Arrow left icon
Product type Paperback
Published in Jan 2022
Publisher Packt
ISBN-13 9781801811576
Length 264 pages
Edition 1st Edition
Languages
Concepts
Arrow right icon
Author (1):
Arrow left icon
Aaron Maurer Aaron Maurer
Author Profile Icon Aaron Maurer
Aaron Maurer
Arrow right icon
View More author details
Toc

Table of Contents (9) Chapters Close

Preface 1. Chapter 1: Getting Started with SPIKE Prime 2. Chapter 2: Building an Industrial Robot Claw FREE CHAPTER 3. Chapter 3: Building a LEGO Guitar 4. Chapter 4: Building a Mechanical Bird 5. Chapter 5: Building a Sumobot 6. Chapter 6: Building a Dragster 7. Chapter 7: Building a Simon Says Game 8. Other Books You May Enjoy

Coding a rock, paper, scissors wrist game

You are now going to code this wrist game to be able to randomly choose rock, paper, or scissors. You can play it against yourself or use it against another human. If you have a friend that has a kit, then you can both build one and compete this way. Start by opening up New Project and giving your project a name such as Rock Paper Scissors:

  1. Using the default yellow when program starts block, add a purple light block named write Hello. You will need to change the word from Hello to Left.

    Figure 1.34 – "Left" being programmed on the screen

  2. Add two yellow Events blocks named when Left Button pressed and when Right Button pressed.
  3. Go to the pink My Block sections of the coding blocks and make two new blocks. Name one start game and the other play again. Add these new blocks to the yellow blocks. Add the start game block for the left button and play again for the right button.

    Figure 1.35 – Decision making with...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image