-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Controller support #416
base: master
Are you sure you want to change the base?
Controller support #416
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very incomplete, has no buttons support, has bad practices and needs more refinement.
@@ -8,6 +8,7 @@ import { ItemType, type ItemDefinition } from "@common/utils/objectDefinitions"; | |||
import { Vec } from "@common/utils/vector"; | |||
import $ from "jquery"; | |||
import nipplejs, { type JoystickOutputData } from "nipplejs"; | |||
import * as PIXI from "pixi.js"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please do not import everything from pixijs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, now it only imports ticker
@@ -342,6 +343,50 @@ export class InputManager { | |||
shootOnRelease = false; | |||
}); | |||
} | |||
const ticker = new PIXI.Ticker(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use Game
class's pixi ticker
const ticker = new PIXI.Ticker(); | ||
ticker.stop(); | ||
ticker.add(() => { | ||
const gamepads = navigator.getGamepads(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you use Game
's pixi ticker, put this into its own method
this.turning = true; | ||
const activePlayer = game.activePlayer; | ||
if (game.console.getBuiltInCVar("cv_responsive_rotation") && !game.gameOver && game.activePlayer) { | ||
game.activePlayer.container.rotation = this.rotation; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't there a better way to do this in the Player
class?
const ticker = new PIXI.Ticker(); | ||
ticker.stop(); | ||
ticker.add(() => { | ||
const gamepads = navigator.getGamepads(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you really need to call this method every frame, is it required?
fix: only imported ticker instead of all of pixi.js
@@ -8,7 +8,7 @@ import { ItemType, type ItemDefinition } from "@common/utils/objectDefinitions"; | |||
import { Vec } from "@common/utils/vector"; | |||
import $ from "jquery"; | |||
import nipplejs, { type JoystickOutputData } from "nipplejs"; | |||
import * as PIXI from "pixi.js"; | |||
import { Ticker } from "pixi.js"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is still wrong, use the Game
update method
also updated cute english (again)
Updated changelog. Bumped protocol version. Bumped package.json version number. Set mode to fall in constants. Map to fall in config.ts. Updated game bg. Updated embed bg. Updated github bg.
This reverts commit 29960d6.
*Not using requestAnimationFrame anymore