Controlador#
Inicialización de la clase controlador#
Para utilizar un controlador en su proyecto, comience inicializándolo de la siguiente manera:
# Create a new object "controller" with the Controller class.
controller = Controller()
This controller
object will be used in all subsequent examples throughout this API documentation when referring to Controller class methods and attributes.
The Controller class comes with three pre-defined attributes, though the screen
attribute is only available if you are using a V5 Controller:
axis
- Permite detectar movimientos en los joysticks del controlador y asignar funciones a eventos de ejes.button
- Le permite detectar pulsaciones de botones y asignar funciones a eventos de botones en el controlador.screen
- Solo controlador V5. Le permite mostrar texto y dibujar imágenes en la pantalla del controlador V5.
Métodos de clase#
In addition to its attributes, the Controller has access to the rumble
method if using a V5 Controller.
controlador.rumble()#
The controller.rumble(pattern)
method sends a rumble string to the V5 controller.
Parámetro |
Descripción |
---|---|
patrón |
Un patrón que utiliza ‘.’ y ‘-’ para ruidos cortos y largos. |
Devoluciones: Ninguna
# Rumble the V5 Controller to the pattern short-short-long-long.
controller.rumble('..--')