Simple PS3ButtonID issue?

27 views
Skip to first unread message

Hope T.

unread,
Aug 11, 2014, 12:00:45 AM8/11/14
to haxef...@googlegroups.com
Hey ya'll, 
just trying to get my player class to use gamepad using ps3. Problem is, I keep getting these problems

source/Player.hx:109: characters 30-43 : Class<flixel.input.gamepad.PS3ButtonID> has no field X

source/Player.hx:114: characters 30-48 : Class<flixel.input.gamepad.PS3ButtonID> has no field SQUARE

source/Player.hx:119: characters 30-50 : Class<flixel.input.gamepad.PS3ButtonID> has no field TRIANGLE

source/Player.hx:124: characters 30-48 : Class<flixel.input.gamepad.PS3ButtonID> has no field CIRCLE

help please! I'm sure it's a noob thing i'm doing

Relevant code

package;

import org.flixel.*;

import flixel.FlxG;

import flixel.FlxObject;

import flixel.FlxSprite;

import flixel.FlxState;

import flixel.group.FlxGroup;

import flixel.text.FlxText;

import flixel.tile.FlxTilemap;

import flixel.util.FlxColor;

import openfl.Assets;


import flixel.input.gamepad.FlxGamepad;

import flixel.input.gamepad.PS3ButtonID;




class Player extends FlxSprite

{

   private var _gamePad:FlxGamepad;


   
override public function update():Void
   {

 
////////PS3 Controller

   _gamePad
= FlxG.gamepads.lastActive;

   
if (_gamePad != null)
   
{
      gamepadControls
();
   
}
    
super.update();

   
}

 

 
private function gamepadControls():Void

 
{

 
if (_gamePad.pressed(PS3ButtonID.X))

 
{

    trace
("The X button of the PS3 controller is pressed.");

 
}


 
if (_gamePad.pressed(PS3ButtonID.SQUARE))

 
{

    trace
("The SQUARE button of the PS3 controller is pressed.");

 
}




 
if (_gamePad.pressed(PS3ButtonID.TRIANGLE))

 
{

    trace
("The TRIANGLE button of the PS3 controller is pressed.");

 
}




 
if (_gamePad.pressed(PS3ButtonID.CIRCLE))

 
{

    trace
("The CIRCLE button of the PS3 controller is pressed.");

 
}

 
}

 
}



Gama11

unread,
Aug 11, 2014, 7:05:17 AM8/11/14
to haxef...@googlegroups.com
I assume you're on the latest release? (version 3.3.5)

Like the compiler error suggests, these fields do not exist there. It's X_BUTTON, TRIANGLE_BUTTON etc.

Hope Tambala

unread,
Aug 11, 2014, 7:03:39 PM8/11/14
to haxef...@googlegroups.com
Haha wow, that's embarrassing! Misread that. Thanks!!!

Hope T.

unread,
Aug 11, 2014, 8:58:12 PM8/11/14
to
The documentation I was looking at says otherwise though.

Hope T.

unread,
Aug 11, 2014, 9:06:02 PM8/11/14
to haxef...@googlegroups.com
Ha, 
guess I need to learn how to use github better too.

Thanks, figured it out!

Gama11

unread,
Aug 12, 2014, 5:15:57 AM8/12/14
to haxef...@googlegroups.com
That's not "documentation" - that's the dev branch. The API docs are here.

Do you not use an IDE with auto completion?
Reply all
Reply to author
Forward
0 new messages