Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1025423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:55:34+00:00 2026-05-16T11:55:34+00:00

I am having a design issue, this may be due to the fact that

  • 0

I am having a design issue, this may be due to the fact that i don’t fully understand cocos2d and box2d yet.

I want to create game objects that have a CCSprite(image data) and a b2Body(physics), Would i be right to make an encapsulating object that contains both? if i did this this would enable me to make changes to the CCSprite

OR

as i have seen in the example code the b2Body has a userData variable which the sprite is set as. Then with this method i would only need to have a single pointer to the physics objects which would take care of the CCSprite.

Thx in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T11:55:35+00:00Added an answer on May 16, 2026 at 11:55 am

    My preferred way of doing it is to encapsulate both in an Actor object. My Actor object is also responsible for updating the CCSprite position/rotation based on the b2Body data. Then I use that Actor object as the userData in the b2Body. Having the Actor as the userData is helpful when iterating over bodies in contact listeners.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having some troubles thinking through a design issue and thought that the
I am having an implementation issue with this basic multilang design. Table content content_id
I have a design issue that I would appreciate some input on. I would
I'm currently having an issue where I have a javascript object that is trying
Looking for advice as to the correct method of solving this design issue I
I'm having a design issue I could use some advice on. Let's say we
Having this design : interface Foo<T> { void doSomething(T t); } class FooImpl implements
Hi I have come up with a small design but im having one issue
I found an issue yesterday with either my table design or a query that
I've been having this design-pattern problem for weeks. Where do I put the logic

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.