Search icon CANCEL
Subscription
0
Cart icon
Cart
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
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

Product type Book
Published in Jan 2022
Publisher Packt
ISBN-13 9781801811576
Pages 264 pages
Edition 1st Edition
Languages
Concepts
Author (1):
Aaron Maurer Aaron Maurer
Profile icon Aaron Maurer
Toc

Table of Contents (9) Chapters close

Preface 1. Chapter 1: Getting Started with SPIKE Prime 2. Chapter 2: Building an Industrial Robot Claw 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 ₹800/month. Cancel anytime