for any other following the thread

---------- Forwarded message ----------
From: claudio canepa <[email protected]>
Date: Thu, Aug 8, 2013 at 2:55 PM
Subject: Re: RectCell collision problem.
To: Art Aquino <[email protected]>





On Thu, Aug 8, 2013 at 11:34 AM, Art Aquino <[email protected]> wrote:

> Claudio, I updated the GitHub project. Sorry, I dont use pymunk on it
> anymore and forgot to delete the import.
>
> ""Try with the value False .
> A alternative way is to delete the boundary, like
>     del cell[i][j].properties['top'] ""
>
> Thanks for the tip Claudio. I was looking at the platformer examples in
> the cocos test directory, specifically the platformer-map.xml file, it has
> the tile properties "top" set to "yes". If it is supposed to be a boolean,
> why is it set to yes?
>
>
Cocos fault, sorry.

The code and the docstrings related to tiles collision say it should be
booleans, but
the example xml codifies those as, by example,
    <tile id="b1"><image ref="i-b1" />

        <property name="top" value="yes" />
    </tile>

It should be:
     <tile id="b1"><image ref="i-b1" />
         <property name="top" type="bool" value="True" />
     </tile>

I will fix that in trunk.

Also, thanks for showing me how to delete the property, this will be part
> of the solution.
>

More things to consider:

do_collision uses Cell.get(propname) to obtain a property value for the
cell, which:
     if  propname in cell.properties  -> returns cell.properties[propname]
     else if propname in cell.tile.properties -> returns
cell.tile.properties[propname]
      else returns None]

So, if you specify the collision properties ('top', ...) only in tiles and
not in cells, you can translate the action
'player blast cell 4, 5 which was rock, converting it to air'
to 'cell.tile = air_tile'

Here you don't need to fiddle directly with properties: changing the tiles
changes the  properties.

On the other side if you want to do a hidden tunnel (player walks past what
it looks as rock, usually don't showing player while in the tunnel) you
could do by using the same tile as rock but setting the appropriate
collision properties at the cell level.

In a pinch, pay attention to at what level you are working : tiles
properties, cell properties

-- 
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