Menu

"Coin" items

2015-11-03
2015-11-12
  • Mark Pearce

    Mark Pearce - 2015-11-03

    Josh,
    When I first tried out your test level, I noticed that there was a bit of a pause or something when you collected the bacon items. Typically, when collecting coins and such in games, there is no resistance from the item, it just dissapears. After a bit of playing I found that iit seemed like you were actually hitting the bacon and you could stand on it for a splt(micro) second before the object was destroyed. I downloaded your project file today, and I was again playing with it and noticed the bounce/pause feeling when collecting the bacon, and it also seemed to do it when collecting the new pepper items as well. (BTW, I love the pepper scale at the bottom.) At first, I was thinking that you might have forgotten to set the collider to "is trigger", but a quick look at your project showed that wasn't the case. So I set out to find out why it was doing that. I created a new sprite and applied a collider and the pepper/coin script, made sure it was set to "is trigger", and it worked fine "out of the box". It took me a while playing with it to see any difference at all, but it looks like the items you had made didn't have a layer assigned to them. I tested this, and as soon as I assign them to the default layer, they started to behaves as you would expect.

    If you look at the image I uploaded here, under the misc folder, you can see what I'm talking about. If I put four peppers, with the correct layer setting, and jump, I can collect all four in one jump. Howerver, if I jump under the bacon, I bounce off each piece, and need to jump four times to get all four peices.

    Anyway, not a big deal, I was just wondering why it was doing that.

    We can remove this post and the image after you have read it.

     
  • Josh Cunningham

    Josh Cunningham - 2015-11-04

    It mind be partillay related to the way that I am detecting collisions. I am using raycasting which probably isn't the most effecient way to do it. I did this following a tutorial that allows for wall jump/sliding. I am learning new ways to handle this sort of thing that might be easier.

     
  • Josh Cunningham

    Josh Cunningham - 2015-11-05

    I figured out what was going. The colliders are handled by the Raycast script and the Collision mask object on the controller 2d scripts. So anything on the same layer as that mask counts as a solid object. The delay was you bouncing off the object before it was triggered.
    I updated the scripts and layers to fix this issue.

     
  • Josh Cunningham

    Josh Cunningham - 2015-11-12

    The new version of build has the coins fixed.

     

Log in to post a comment.