article thumbnail

Handle the collision of sprites

Cocos

I’m trying to handle the collision of two sprites, i added BoxCollider2D to the sprites. One sprite can jump (changing the y coordinate through animation), named "character ", the other is a static object, named “key”. code for the "character ". start () {. this.collider.on(Contact2DType.BEGIN_CONTACT, code for the “key”.

Sprite 40
article thumbnail

Atari ST Programming: STOS BASIC Sprite Movement

Retro Game Coders

In the last part of this STOS BASIC Tutorial we loaded a sprite but it just sat there, let’s fix that … One of the ways that STOS BASIC helps us to build interactive programs and games is in the sprite movement features because they are not only easy, but they do their thing without our constant input. Custom Mouse Pointer.

Sprite 52
Insiders

Sign Up for our Newsletter

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Trending Sources

article thumbnail

Handle the collision of sprites

Cocos

best way to debug this kind of bugs is to activate physic debugging, add this to your code. onLoad() { PhysicsSystem2D.instance.debugDrawFlags = EPhysics2DDrawFlags.Aabb | EPhysics2DDrawFlags.Pair | EPhysics2DDrawFlags.CenterOfMass | EPhysics2DDrawFlags.Joint | EPhysics2DDrawFlags.Shape; }

article thumbnail

Sprite Object Shape question

Cocos

Seems like we could grab those coordinates and then create an object at those coordinates to trigger collision with a 2dcollider component and have the collision trigger the function our button normally would? stringwizard5: do we not have the ability to get the mouse position coordinates on mouse click without raycasting?

Sprite 40
article thumbnail

Sprite Object Shape question

Cocos

also, it probably wouldn’t be a good solution for someone making a game that uses a bunch of collision objects as clicking on a collidable object would cause it to trigger.

Sprite 40
article thumbnail

Sprite Object Shape question

Cocos

Seems like we could grab those coordinates and then create an object at those coordinates to trigger collision with a 2dcollider component and have the collision trigger the function our button normally would? do we not have the ability to get the mouse position coordinates on mouse click without raycasting?

Sprite 40
article thumbnail

intersectRect not working with a sprite if is a child?

Cocos

spriteAWorldPos.y, spriteA->getContentSize().width, width, spriteA->getContentSize().height); height); if (spriteAWorldRect.containsPoint(Vec2(spriteBWorldPos.x, spriteBWorldPos.y)) ||. spriteAWorldRect.containsPoint(Vec2(spriteBWorldPos.x + spriteB->getContentSize().width, width, spriteBWorldPos.y + spriteB->getContentSize().height))

Sprite 40