melhorias joystick

This commit is contained in:
rafaelbarbosatec
2020-06-24 10:42:48 -03:00
parent d8ba6c546c
commit 2a808af98b
2 changed files with 6 additions and 6 deletions

View File

@ -55,7 +55,7 @@ class JoystickAction {
}) {
_spriteAction = sprite;
_sizeBackgroundDirection = sizeFactorBackgroundDirection * size;
_tileSize = _sizeBackgroundDirection / 3;
_tileSize = _sizeBackgroundDirection / 2;
}
void initialize(Size _screenSize, JoystickController joystickController) {

View File

@ -9,8 +9,6 @@ import 'package:flutter/material.dart';
import '../../position.dart';
class JoystickDirectional {
static const double _backgroundAspectRatio = 2.2;
final double size;
final Sprite spriteBackgroundDirectional;
final Sprite spriteKnobDirectional;
@ -64,7 +62,7 @@ class JoystickDirectional {
..style = PaintingStyle.fill;
}
_tileSize = (size / 2) * _backgroundAspectRatio / 3;
_tileSize = size / 2;
}
void initialize(Size _screenSize, JoystickController joystickController) {
@ -133,8 +131,10 @@ class JoystickDirectional {
final double nextY = dist * sin(_radAngle);
final Offset nextPoint = Offset(nextX, nextY);
final Offset diff = Offset(_backgroundRect.center.dx + nextPoint.dx,
_backgroundRect.center.dy + nextPoint.dy) -
final Offset diff = Offset(
_backgroundRect.center.dx + nextPoint.dx,
_backgroundRect.center.dy + nextPoint.dy,
) -
_knobRect.center;
_knobRect = _knobRect.shift(diff);