Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

CCMotionStreak in CocosSharp Not Working

$
0
0

I'm working with CocosSharp in Visual Studio for Mac and I'm trying to get CCMotionStreak to work but I've not had much luck.

It seems to be setup correctly but I can't get it to move. Setting the position does nothing, it's always at 0,0.

Has anyone been able to get this to work? Also, this is in an Android project.

  private void ResetMotionStreak ()
    {
        RemoveChildByTag(MOTION_STREAK_TAG);
        var motionStreak = new CCMotionStreak(0.5f, 1, 10, CCColor3B.Green, "line");
        AddChild(motionStreak, 1, MOTION_STREAK_TAG);
    }

    private void AddMotionStreakPoint (CCPoint point)
    {
        var streak = GetChildByTag(MOTION_STREAK_TAG);
        streak.Position = point;
    }

    void OnTouchesBegan(List<CCTouch> touches, CCEvent touchEvent)
    {
        if (touches.Count > 0)
        {
            ResetMotionStreak();
            AddMotionStreakPoint(touches[0].Location);
        }
    }

    void HandleTouchesMoved (System.Collections.Generic.List<CCTouch> touches, CCEvent touchEvent)
    {
        if (touches.Count > 0)
        {
            AddMotionStreakPoint(touches[0].Location);
        }
    }

Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>