How do I make this feature for my game?

Hi there Corona Community!

 

I need help making a part of my game!  I need an object to move around a circle in a continuous motion.  When the screen is touched, the object will then go continuously in the other direction.  

 

To know what I need accomplished, check out the game below called “Circle Surfer”!

The little character rotating around the circle is exactly what I need done but when the user touches the screen it reverses directions! Thanks in advance!

 

https://itunes.apple.com/us/app/circle-surfer/id898607045?mt=8

What exactly do you need help with? Do have code that isn’t working? Do you need information on how to structure the rotational logic?

@alex

Thanks for responding!  Frankly, I have absolutely no idea on how to accomplish this feature!

I have no code!  I need to know what I can use to make this. Is there a documentation for it?  Can you code a basic example for me?  Either one works.

Also, another example of what I need is in the game “Circle Pong!”

I need a “paddle” or moving object to rotate around a circle continuously. 

Checkout Circle Pong! here: https://itunes.apple.com/us/app/circle-pong!/id905229109?mt=8

In the game above is exactly what i need done!

Thanks in advance!

-Max Goldberg

Like this? 

https://www.youtube.com/watch?v=rcSn25NwvKg&feature=youtu.be

@roaminggamer

Yes!  That is exactly the feature I need!  Can you please tell me how to accomplish this or please post a tutorial thanks!

-Max Goldberg

It is already available.

The code is the sampler:

https://github.com/roaminggamer/SSKCorona/tree/master/sampler/samples/askEd/rotateAboutPoint

@roaminggamer

Thanks for the code!  However, I cannot figure out how to make it run.  Can you send me exactly what I need to put into my folder and such? thanks

Sorry I can’t.  However, the sampler comes with help which points to a video explaining how to extract samples:

https://www.youtube.com/watch?v=66nd7EIZn00

@roaminggamer

I dont understand your video.  It is very confusing in my opinion.  Can anyone just give me some code or point me to a corona documentation section or a tutorial online? Thanks

bump Please HELP!

What exactly do you need help with? Everything you need to create this functionality is in this thread.

I have no idea on how to make the feature. He sent me a video explaining how to extract “publics”. Not only do I not understand this, it won’t run on my computer without error. Does anyone else know how to do this without @roaminggamers code? Thanks

@Roaminggamer gave you all of the code needed to accomplish this. It’s in the github link he posted above. It’s all in lua and can be used to create the effect which you are trying to achieve.

Judging from your other posts, you are basically trying to run before you can walk. You need to go back to square one and try to understand the basic concepts behind Corona SDK, lua code structuring and game development philosophy.

I started out asking questions which had answers far above my pay grade, so I understand trying to get to work and build what you want without waiting. But, you still need to learn first. People like Ed can only provide so much support for free before they need to go back to actually logging billable hours.

Searching with Google and through past Corona forum posts are going to be your best friend here. I put together the “From the Forum” posts every Friday, and I know there is a wealth of information available. All you need to do is search for it. Don’t get discouraged, keep experimenting, try stuff, see it break, and try to fix it. Oh, and always adhere to the advice roaminggamer gives in this thread.

TL;DR: Google is your friend. I posted a snippet of how to achieve this exact behavior on my github page as well. It’s barebones, and couldn’t be more simple.

https://github.com/pancinteractive/axisrotation

@Max,

I’m sorry SSK, the sampler, and the video were not helpful.  I’m still struggling to find a way to engage the newest users.  The sampler as it stands is designed for folks who have some foundation in Lua, Corona, game-design concepts, 2d-math, and physics.  

I realize it can be difficult to penetrate when one is new to some of these things.

All I can say for now is, I’m working on alternatives for getting answers into people’s hands and when I get it worked out, I’ll make an announcement.

Till then, keep trying, learning, and best of luck in your development efforts.

-Ed

As simple as can be:

local centreX = display.contentCenterX local centreY = display.contentCenterY local radius = 50 local angularVelocity = 0.1 local angle = 0 local circle = display.newCircle(centreX, centreY, radius - 10) local crate = display.newImage("crate.png") crate.width = 20 crate.height = 20 crate.x = centreX + radius \* math.cos(angle) crate.y = centreY + radius \* math.sin(angle) local function frameUpdate() angle = angle + angularVelocity crate.x = centreX + radius \* math.cos(angle) crate.y = centreY + radius \* math.sin(angle) end local function onTap() angularVelocity = angularVelocity \* -1 end Runtime:addEventListener("enterFrame", frameUpdate) Runtime:addEventListener("tap", onTap)

Just put that in your main.lua file, and as long as you’ve got the crate.png image, it’s good to go.

Frankly, I have absolutely no idea on how to accomplish this feature!

I have no code!  I need to know what I can use to make this. Is there a documentation for it?  Can you code a basic example for me?  Either one works.

Did you miss my previous post? It does exactly what you’ve asked. Or have I misinterpreted?

@hasty, that’s just spam. It’s copy and pasted from a previous comment.

Um, no. The OP said they were having trouble getting what roaminggamer provided to work. I wrote a simpler version that is fully plug-and-play. It does exactly what was asked. I must be missing something.

@hasty, seo.SubAccount.1 isn’t OP. If you go back to the 3rd comment of the thread, you’ll see that seo.SubAccount.1 just copied and pasted sentences from that comment. What purpose this could serve, is anyone’s guess.

Who knows how OP got on with their request. They were given 3 viable options, but haven’t confirmed the resolution.