Skip to main content

Library to edit FRHD tracks

Project description

Free Rider HD is an HTML5 game that utilizes the canvas element to display an interactive biking game. This script allows you to make your own tracks using Python! Let’s go over the basic syntax:

First of all, import the library:

import frhd

Now create a track class:

my_track = frhd.Track.Track()

Now that you have the frontmatter out of the way, create a line by calling

my_track.insLine('p', -40, 50, 100, 50)

The 'p' in that statement tells the code to create a physics line. Now you need to print out this code:

print(my_track.genCode())

To create a scenery line you use the same code as last time, with the exception of replacing the 'p' with an 's'. What you have should look like this:

import frhd
my_track = frhd.Track.Track()
my_track.insLine('s', -40, 50, 100, 50)
print(my_track.genCode())

To add a boost just use this syntax:

my_track.insBoost(90,-10,90)

A quick note on how the coordinates work: The origin of the cartesian coordinate plane (0,0) is located near the center of the rider. To see where this is, turn on the grid in the editor. Zoom out. You should see thicker, darker lines at certain intervals. Where they intersect inside the rider is (0,0). When drawing a line, the first argument is the line type and then you can add as many coordinates as you want (e.g. my_track.insLine(‘p’, x1, y1, x2, y2, x3, y3, x4, y4)). When using any kind of power-up, the third coordinate is acually degrees of rotation. Every coordinate is one-tenth of a ten grid square (the default size when you show the grid).

The other power-ups are as follows:

my_track.insBoost(90,-10,90) # Boost
my_track.insBomb(90,10) # Bomb (no rotation as it is omni-directional)
my_track.insGravity(90,10,90) # Gravity
my_track.insCheck(90,10) # Checkpoint
my_track.insStar(90,10) # Star
my_track.insSlowMo(90,10) # Slow Motion

NOTE: As it is a pain to update the docs at pypi I will not keep these updated very well. To see the up to date docs go to https://github.com/gaetgu/frhd/wiki/

This project was inspired by frhd.js, a library made by ObeyLordGoomy that does the same thing, but for JavaScript.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

frhd-python-5.1.tar.gz (5.8 kB view details)

Uploaded Source

File details

Details for the file frhd-python-5.1.tar.gz.

File metadata

  • Download URL: frhd-python-5.1.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for frhd-python-5.1.tar.gz
Algorithm Hash digest
SHA256 75fc60cf9e545af3963a252208371ada7b4ad7bdaec8ba61bd5624b55f077f3f
MD5 b040f96a5ada2e266de13d0e41deb276
BLAKE2b-256 52c5cf18cb5ff2315b6db2b488d2387b02e58b56a804d398a69763851356ad65

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page