Sprite along circumference of a circle

0 favourites
  • 11 posts
From the Asset Store
You can change amount and speed of circles, length of lines and etc. Only 6 events.
  • I want my sprite to follow the (path) circumference of a circle.

    When I press the left arrow key the sprite should move left following the path and when I press the right arrow key the sprite should move back right.

    I've tried using the formula

    X1 = X + radius * cos(angle)

    Y1 = Y + radius * sin(angle)

    But I'm not sure if I'm heading in the right direction

    I've uploaded an example. The blue sprite should follow along the black path.

    I hope someone can help me out on this one.

  • The simplest way would be not using math at all, instead pin the Blue Sprite on the Circle Sprite and rotate the later...

    Here is an example capx.

    Somebody , thanks for the link! The things that I should read to educate my self grows exponentially!

  • Thanks. I'll take a look at the .capx file.

    I got mine working with a formula. I forgot to increment the degrees after every press of the key! Duh

  • Thanks eli0s! I figured out how to make the sprite move faster a long the path, but how do I make it follow an invisible path. I can't have a black path on top of my backgound scene

  • Justin1967 , just use a different (invisible) Sprite for the rotation and keep the one with the Circle as a graphical backdrop. You should align the pivot point of the invisible Sprite with the Circle's center of course.

  • [quote:23y77p72]Thanks eli0s! I figured out how to make the sprite move faster a long the path, but how do I make it follow an invisible path. I can't have a black path on top of my backgound scene

    Can't you just set: FollowPathOfCircle properties - Initial visibility to Invisible ?

  • Gunter , you are right. I had misinterpreted Justin1967's question. I thought that he was asking for the Circle sprite to be visible but not move. Setting the visibility options to invisible is the way to go.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks for all your help guys. Is there btw a tutorial on 'enemy attack waves' ? Not one the moves on a straight path, but a more complex one like curves, circles etc. What's the best approach?

    Couldn't find anything on the forum or on Google.

  • There are some very well paced videos on Scirra's Youtube channel. There is

    Subscribe to Construct videos now

    that tackle the basics of a wave pattern system.

    Subscribe to Construct videos now

    is older but is more in depth and maybe more instructive.

    You can use multiple behaviors and build very complex systems but all that need some experimentation. Also try the Circle behavior, perhaps it can help you build even more complex stuff.

  • I was just thinking about moving a sprite around the player in a circle:

    make an invisible sprite with it's primary image point on one end and set its width the radius of the circle you want and point2 on the other end.

    Then pin your object to the invisible sprite at image point 2 and then rotate the invisible sprite... voila your thingy goes around a circle.

    Oh looks like eli0s beat me to it! haha..

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)