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 ". code for the “key”. code for the "character ".

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. Why is this useful?

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

Module 3: Attack of the Snake (Lesson 10)

Game Designing

And the way to do that is by altering the collision mask on our block. Now, we haven’t talked about collision masks yet, so let’s do a quick overview of them and we’re going to dive way deeper into them in the next module where we make our space game. So open up your S p R block or really any of your sprites.

article thumbnail

intersectRect not working with a sprite if is a child?

Cocos

According to my initial code, it looks like that intersectsRect() doesn’t work in world space. spriteAWorldPos.y, spriteA->getContentSize().width, width, spriteA->getContentSize().height); height); if (spriteAWorldRect.containsPoint(Vec2(spriteBWorldPos.x, spriteBWorldPos.y)) ||. spriteBWorldPos.y + spriteB->getContentSize().height)))

Sprite 40
article thumbnail

Sprite Object Shape question

Cocos

I was about to have to start checking pixels for alpha values… I was thinking about a less expensive way to accommodate circular buttons that could potentially be added to cocos natively… I realize the button component event system needs a node for the target because the event system works on Nodes… but I wonder if there is a way to set it up where (..)

Sprite 40
article thumbnail

Atari ST Programming: A Simple Game in STOS

Retro Game Coders

Now we can move sprites in STOS we need to put things together to see how we can actually begin creating playable games. This isn’t intended to be super fun, just ensure we know how to have a bad guy sprite that can cause the game to end when our player character is eaten. Background Tiles and Beating the Sprite Limits.

Sprite 52