🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

cocos2dx drawing polygons and move them

Started by
4 comments, last by Rutin 5 years, 8 months ago

Say i want to draw 5 triangles and to move them in different directions over time. how would one achieve this in cocos2d-x?

Advertisement

Someone might be able to give you an example, but it seems like your best bet might be to work through some Cocos2d-x tutorials.

I found this:

https://www.raywenderlich.com/1848-cocos2d-x-tutorial-for-beginners

It's 'archived', and doesn't have a date on it, so it's possible it's out of date with respect to the current version of the library. But I'd guess it's mostly still applicable (and maybe entirely so). It looks like it covers basic motion, in which case it should answer your specific question, generally speaking.

There's also the main site here:

http://www.cocos2d-x.org/

I don't know much about Cocos Creator, but it might allow for doing what you have in mind via higher-level tools. The site also has a 'Learn' section (in the menu at the top), which includes documentation and a 'Get Started' section with tutorials.

I see some indications that Cocos2d-x has some shape-drawing functionality. I don't know much about this, but you might be able to use it for what you describe. Failing that, you can of course use images/sprites.

[Edit: Minor clarification.]

After posting the above, it occurred to me that this might be homework. If it is, I'd state that in your post, and also check the site rules, as I think there are some rules/guidelines about posting homework questions.

17 minutes ago, Zakwayda said:

After posting the above, it occurred to me that this might be homework. If it is, I'd state that in your post, and also check the site rules, as I think there are some rules/guidelines about posting homework questions.

no it is not homework, there is no straightforward way to do what i am asking (maybe there is one that i have overlooked) , that's why i am asking

3 hours ago, oblivion_ said:

no it is not homework, there is no straightforward way to do what i am asking (maybe there is one that i have overlooked) , that's why i am asking

Without looking through the library itself... The standard approach once the sprites are drawn is to use a random variable that decides the direction of movement per sprite, and you can cycle this per (x) ticks, or with a timer.

Programmer and 3D Artist

This topic is closed to new replies.

Advertisement