Git Product home page Git Product logo

haxeflixel-analog-gamepad-polar-coordinate-tank-movement's Introduction

HaxeFlixel Analog Gamepad Polar Coordinate Tank Movement

Move a simple shape around using polar coordinates with analog gamepad controls in tank style

A great starting point for game projects and game jams.

See our other HaxeFlixel Code Samples

See all of our GameDev resources


Move an Nested Sprite around using Polar Coordinate Movement with a gamepad like a tank

This is best for tank style movement, like a top down tank shooter.

If you want even x and y angular movement, like a top down adventure game or a free moving space shooter (Geometry Wars style) then see this Proof of concept instead HaxeFlixel-Analog-Gamepad-Polar-Coordinate-Movement

This demo autodetects your connected usb gamepad. This project uses a usb Logitech gamepad, though other gamepads can be used if you modify the code a little, check the docs for compatible configurations:

movement

notice how the turret "sticks" to the tank base when the base rotates

Plug in a usb gamepad. Test this proof of concept.

Controls :

  • Left Analog Control Stick
    • x axis - rotate the tank base
    • y axis
      • up to move forward
      • down to move in reverse (reverse has slower move speed)
  • Right Analog Control Stick x axis - rotate the turret

Gamepads used :

Aftermarket usb gamepad, walmart link, newegg link

USB Gampad

Logitech F310 usb gamepad - newegg link

Logitech Gamepad

on the back of this gamepad, there is a switch setting for x and d, set it to d if it's not detected (osx)


To run this proof of concept

Setup

only need to do this once

Install OpenFL and Haxe Install HaxeFlixel

Sublime Text users, get the Haxe Plugin

Get Sublime Text Package Control

https://packagecontrol.io/installation

ctrl + shift + p to open the Sublime Text command palette

Command Palette

package install

"Haxe"

Atom users, get the Haxe Plugin

ctrl + shift + p to open the Atom command palette

Command Palette

install package

"Settings View: Install Packages and Themes"

Perform a search for Haxe and install the package.

Also install dependent packages:

Then search for lime and install this package too.

Other Haxe Editors

Vim users, get vaxe

More editors an IDEs


Testing

Run With Sublime Text Plugin

open this project in Sublime Text

open the Main.hx file

Choose compile target using ctrl + shift + b

compile target

Test the project using the chosen target ctrl + enter

Run With Atom

open project with Atom

in the project drawer, right-click on project.xml and Set as active Lime/OpenFL file

Set as active Lime/OpenFL file

open the command palette with ctrl + shift + b and select Lime: set target

Set lime target

set current build target to neko (or your desired target)

command + b or control + b to build and test for the selected target

Run With Command Line

lime test neko

haxeflixel-analog-gamepad-polar-coordinate-tank-movement's People

Contributors

theremix avatar

Watchers

 avatar  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.