public void InitializeJoystick()
        {
            joystickPanel = new SneakyPanelControl(LayerSizeInPixels, 2);
            joystickPanel.Position = CCPoint.Zero;
            joystickPanel.Orientation = ButtonsOrientation.Vertical;

            AddChild(joystickPanel,  JOYSTICK_Z_ORDER);
        }
Esempio n. 2
0
 public void Step(SneakyPanelControl controlPanelLayer, CCSize MapTotalSize, float MapMaxTop, float dt)
 {
     if (actionState == ActionState.Walk)
         desiredPosition = Position + (velocity * dt);
     //Update player position
     CCPoint tmpPosition = SneakyPanelControl.GetPlayerPosition(this, dt, new CCSize(MapTotalSize.Width, MapTotalSize.Height));
     float posX = Math.Min((MapTotalSize.Width) - centerToSides, Math.Max(centerToSides, tmpPosition.X));
     float posY = Math.Min(MapMaxTop + centerToBottom, Math.Max(centerToBottom, tmpPosition.Y));
     Position = new CCPoint(posX, posY);
 }
Esempio n. 3
0
        /// <summary>
        /// Second Initial State. Window screen objects
        /// </summary>
        /// <param name="windowSize"></param>
        protected override void AddedToScene()
        {
            base.AddedToScene();

            InformationLayer = new CCInformationPanelBase();
            Scene.AddChild(InformationLayer, 99999);

            //Player Shoot events
            //PlayerListener = new CCEventListenerCustom(EVENT_PLAYER_ID, OnPlayerShoot);
            //AddEventListener(PlayerListener, 1);

            //Enemy Shoot events
            EnemyListener = new CCEventListenerCustom(EVENT_ENEMY_ID, OnEnemyShoot);
            AddEventListener(EnemyListener, 1);

            //SNEAKY JOYSTICK
            controlPanelLayer = new SneakyPanelControl(wSize, 2);
            controlPanelLayer.Position = new CCPoint (70, 70);
            #if DEBUG
            controlPanelLayer.IsDebug = true;
            #endif
            InformationLayer.AddChild(controlPanelLayer, 9999);
        }
Esempio n. 4
0
        /// <summary>
        /// Second Initial State. Window screen objects
        /// </summary>
        /// <param name="windowSize"></param>
        protected override void AddedToScene()
        {
            base.AddedToScene();
            //We need to reposition the item

            InformationLayer = new CCInformationPanelBase();
            //Scene.AddChild(InformationLayer, 99999);
            //InformationLayer.ContentSize = wSize;

            //InformationLayer.Position = -wSize.Center;

            //Player Shoot events
            //PlayerListener = new CCEventListenerCustom(EVENT_PLAYER_ID, OnPlayerShoot);
            //AddEventListener(PlayerListener, 1);

            //Enemy Shoot events
            EnemyListener = new CCEventListenerCustom(EVENT_ENEMY_ID, OnEnemyShoot);
            AddEventListener(EnemyListener, 1);

            //SNEAKY JOYSTICK
            controlPanelLayer = new SneakyPanelControl(wSize, 2);
            #if DEBUG
            controlPanelLayer.IsDebug = true;
            #endif
            Scene.AddChild(controlPanelLayer, 9999);
        }