Giter Club home page Giter Club logo

minecraft-bike's Introduction

โ›๏ธ Playing Minecraft with a Bike ๐Ÿšฒ

Originally coded 3/28/2021 at age 16, I used the Titan Two hardware to run GPC code which converted gyro movement of bike wheel and button inputs on handlebars, also used reWASD and a third joycon for steering.

Showcased in the video below, the actual coding portion is small and the video is mainly me actually playing Minecraft with the bike controller, and the beginning is construction a wooden mount to hold my non-stationary bike to make it stationary. But from ~2:40-5:00 I explain how I actally coded it.

But the main process involves writing GPC code which takes in inputs from the Nintendo Joycons and maps the buttons to the inventory, jump, break/place functions of the game, as well as calculating movement from the gyroscopic movement of a second joycon attached to the back wheel. The process to do this was relativley simple once I figured it out (I guess most things are simpler after you solve them right?) But what I did was, in testing I would look at the X-Acceleration reading (since each orientation had a distinct value) and recorded what the values were when the joycon was above the center of the wheel, and then what it was when below the center of the wheel.

Watch the Video

What I did was when there was a reading on the bottom, add 1 to a variable called bottom, then, I tested if the reading was at the top, and if bottom was ALSO greater than top, (so meaning it was at the bottom (bottom = 1), and is now at the top (top = 0) add 1 to top.

I also had a running timer which made sure that if it had been more than 1 second since bottom changed, at the time of top changing, set them both back to 0 and reset the timer.

This meant that the only way for bottom and top to reach 3 or higher (the threshold I set to allow the output of a keypress of W (forward movement), was if the bike wheel was moving fast enough for the threshold to be met before the timer was up. If you kept this constant speed, the timer resetting the top and bottom values doesn't affect you since, almost immediatley, the values would reach the threshold again.

minecraft-bike's People

Contributors

tiernandefranco avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.