On Tue, Aug 6, 2013 at 12:02 AM, Brandon Jumbeck <[email protected]>wrote:

> Hey everyone, so I am running into a problem when trying to structure my
> classes for a platformer. Basically I am taking the code from the one of
> the examples and breaking it up into seperate classes and file instead of
> one file to get more experience with how this library works.
>
> I believe I got most of it working correctly but I can't seem to get the
> player to move with the keyboard inputs. Not this could be two things I
> believe 1) I am not passing the key.KeyStateHandler() objects correctly or
> 2) My player controller isn't working correctly. Well actually to be honest
> it could be any number of things since I am still quite inexperienced with
> cocos and still don't have a good grasp on everything.
>

You should narrow the problem.
Player movement is PlayerController.step responsibility, so put some prints
to see where things go wrong:
    Is step called at all ?
    Any key is seen to change ?
   The tentative new position changes ?
   The position after collision check changes ?

Once you have a where, you could begin to reason about the why, and maybe
ask again.


> Anyways I was wondering if you could take a look at the code and see if
> you can find anything that might be causing the problems. As to not spam
> the forums and to keep correct format I'll post pastebin links for each
> file that is relavant. And here is the structure of it.
>
> main.py <http://pastebin.com/dGtK1mnB> - Just Initializes director and
> runs the testing scene
>
> playerController.py <http://pastebin.com/aXdYRtqF> - This is the
> controller that controls player movement and collision with the tilemap
>
> testingLevel.py <http://pastebin.com/Q5f10yaN> - This is where I put
> together the testing scene
>
>
>

Not trying to be rude, but realistic: you have much better probabilities
that someone looks at the code if it is an easily runnable sample.
In this case, a zip with code + resources somewhere, and a link in the post.


> Thanks in advance for your advice, look forward to learning this framework
> and its amazing features. Will keep looking into the problem by browsing
> the API reference and the web also so will update this if I find the
> problem/solution.
>

-- 
You received this message because you are subscribed to the Google Groups 
"cocos2d discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cocos-discuss.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to