You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working on finding efficient ways to detect whether or not my "player" sprite is colliding with something bad or something good. Right now my code looks like this:
on_contact_begin do |contact_event|
puts "Bad: #{@hero.intersects?(@bad_guy)}"
puts "Good: #{@hero.intersects?(@other_guy)}"
end
Looks like I forgot to wrap this one :( It shouldn't be hard to do this, you can add PhysicsContact to https://github.com/HipByte/motion-game/blob/master/src/events.cpp then change the #on_contact_begin callback to create and pass it (you can look at similar methods that create these event objects for an example of use).
I noticed that the
on_contact_begin
method is documented as yielding anEvents::PhysicsContact
object. However, the code actually returnsNULL
. I am curious if this event object could provide some helpful information when determining collision behavior.I'm working on finding efficient ways to detect whether or not my "player" sprite is colliding with something bad or something good. Right now my code looks like this:
I'm assuming that checking the intersection of
@hero
on every collision is not the right approach. I wonder ifcocos2d::PhysicsContact
is intended to provide this information. Here is the documentation for that: http://cocos2d-x.org/docs/api-ref/cplusplus/v3x/d5/d22/classcocos2d_1_1_physics_contact.htmlThe text was updated successfully, but these errors were encountered: