Hi Claudio,
I didn't realize that I found a bug, but when I tried the same code with a 
cocos map instead of a tmx map the issue didn't persist, I realized 
something fishy was going on..
I apologize that the code was so unclean, I re purposed the code from that 
pymunk demo I talked about.

I took a look at the demo you made, and I noticed these comments:

# WARN: this was hacked for bugdemo purposes only; don't use in real code:
#       lots of globals
#       position delta must use dt, else unpredictable view velocity 

I replaced all the 'from x import y'  with one specific 'import cocos'. is 
this what you meant about lots of globals?
I suppose that's a newbie mistake, I thought it would make the code more 
readable.
Now, what you said about multiplying the position by delta time. Do you 
mean something like this:

    def update(self, dt):
        last = self.get_rect()
        new = last.copy()
        new.x += self.dx * dt
        new.y += self.dy * dt
        self.collider.collide_map(tilemap, last, new, self.dy, self.dx)
        self.position = new.center
        scroller.set_focus(*new.center)

If I use this, I get pretty much the same result as when I don't multiply 
by delta time.
You wrote it would create " unpredictable view velocity ", does that mean 
objects will be moving at different speed / at a different position than 
what they would appear to be going at?

p.s, thank you for the quick fix for the bug and the vigilance noticing it.

On Monday, September 21, 2015 at 12:32:06 AM UTC+3, Claudio Canepa wrote:
>
> I filled an issue in the bugtracker, 
> https://github.com/los-cocos/cocos/issues/248
>
> Theres a bug in RectMapCollider
>
> A partial workaround was committed to master. It probably lets you 
> progress in your game, but still show some defects:
>
> still seen two stuck cases
>    player pushes a wall on the left at the same time it wants to go down
>    player pushes a wall on the top side and wants to go left
>
> It only stuck at grid crossings
>
> The stuck in non definitive: releasing the pressure against the wall 
> resumes normal
>
> If not actively pushing against the wall the movement is normal
>
> Ask if you need help to use cocos from master.
>
> To @all 
>
> I checked in Netanel bugdemo code with some modifications at 
> https://github.com/los-cocos/etc_code
> If someone want to investigate and provide a real fix I will happily merge.
>
>
>
>
>
> On Sat, Sep 19, 2015 at 12:32 PM, Netanel M. <[email protected] 
> <javascript:>> wrote:
>
>> I fixed it the issue where the sprite was flying off by using this code 
>> instead:
>> layer.sprite.position = new.center
>> instead of layer.sprite.position = new.position;
>>
>> But now, the sprite get's stuck whenever it hits the floor!
>> I attached the fixed source. What could possibly cause this?
>>
>> -- 
>> 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] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> Visit this group at http://groups.google.com/group/cocos-discuss.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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/d/optout.

Reply via email to