[Tutor] movement controls

Luke Paireepinart rabidpoobear at gmail.com
Fri Mar 19 02:25:39 CET 2010


You should probably decouple the view from the model - have the character
move around in a 2d plane in the model and then just draw the level in a
certain area around the 2d coordinates of the character.

On Thu, Mar 18, 2010 at 6:51 PM, <snet-1 at msn.com> wrote:

>  A little stuck and could do with any sudjestions.
>
> Aim:-
> When the character goes past the middle of the screen, the background &
> level move downwards so the character can get to higher places, think sonic
> the hedgehog.
>
> This is the bit I'm having problems with, I can get the character to get to
> the center, the background moves up & down but the character won't go back
> down when the level returns to normal height.
>
>     if bkGroundRect['rect'].top < 0 and charRect['rect'].top <
> winCenterRect.top:
>
>         bkGroundRect['rect'].top += spY
>         platRect['rect'].top += spY
>         jumpRect.top += spY
>         charRect['dir'] = STOP
>
>
>     if levelRect['rect'].bottom > winHeight and charRect['rect'].centery ==
> winCenterx:
>             bkGroundRect['rect'].bottom -= spY
>             platRect['rect'].bottom -= spY
> #            jumpRect.bottom -= spY
>             charRect['dir'] = STOP
>
>   #--this won't execute ? --#
>     if levelRect['rect'].bottom <= winHeight:
>         if charRect['rect'].centery >= winCenterx and
> charRect['rect'].centerx < jumpRect.centerx:
>             charRect['dir'] = DOWN
>
> I've included the whole code as a note pad so the above makes more sense,
> don't worry about all the comments, that's just for my convenience.
>
> Thanks guys
>
> Mark
>
> 'knight meets wall, wall won't let knight pass, knight says 'neh'
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100318/f95b96c8/attachment.html>


More information about the Tutor mailing list