thebearingedge / driving-game Goto Github PK
View Code? Open in Web Editor NEWA top-down driving game using classes and timers.
A top-down driving game using classes and timers.
Users will want to control the car, but they have to be able to see it!
Once the user starts the car, they'll need to be able to stop it!
Car
to stop it.Car
to check if the car is started.Closing in favor of #15
Users will expect the car to accelerate to full speed rather than abruptly begin moving across the screen.
topSpeed
and isAccelerating
.accelerate
method.decelerate
method.' '
(spacebar) control to toggle acceleration.speed
property to be currentSpeed
.move
method to update
for better semantics.acceleration
property to the Car
.move
method to account for whether the car is isAccelerating
.
currentSpeed
is 0 and not isAccelerating
, do nothing.currentSpeed
is below its topSpeed
and the car isAccelerating
, update the car's position and increase its currentSpeed
by its acceleration
.traction
property to the car.currentSpeed
is above zero and not isAccelerating
decrease its currentSpeed
by its traction
.move
method closer to their use.decelerate
method to coast
.isStarted
to a Boolean
value.isAccelerating
if it isStarted
.currentSpeed
from whether it isStarted
.Releasing the accelerator may not slow the car down fast enough.
isBraking
property to the car.isBraking
.brakes
property to the car.update
method to account for whether the car isBraking
.Once their car is started, the user will want to steer it.
Car
that updates its direction and marker rotation.move
instance method to account for direction.keypress
listener to also turn the car when arrows are pressed.The user will want to drive their car, so they need to start it.
Car
class that takes a marker element, direction, speed, and location.move
method to the Car
that updates its location and its marker position.start
method to the Car
that continuously updates its location and its marker position.A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.