article thumbnail

Have the sprite's aim rotate to the mouse position

Cocos

I’m building demo for a top-down shooter and I want the sprite to aim and rotate where the mouse is pointing. I’m having trouble getting the sprite to rotate correctly. It only goes 180 and then back to 0, not going a full 360. mousePos.y - center.y); const angle = Vec2.angle(direction,

Sprite 40
article thumbnail

Sprite aspect ratio

Cocos

Can you provide the code of your transformation or a simple demo to see?

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

Cocos 3.7.3 Using Material setProperty on Spine only take effect for the first time

Cocos

Hi, I am writing a simple shader for spine, and use ts code to animate that shader by setProperty function. The same logic work with sprite, but not Spine. Here is my demo TestShaderSpine.zip (5.3 How can I make setProperty work inside a tween?

Shaders 40
article thumbnail

Tag to prefab dynamically and intersect in script

Cocos

This is the Cocos2dx code snippet. count++; demo = Sprite::create(“d1”); demo->setPosition(Vec2(362.399170,831.098450)); demo->setTag(count); this->addChild(demo); if ( this ->getChildByTag(i)->getBoundingBox().containsPoint(location)) I want to do this in the creator-type script.

article thumbnail

Cocos 3.7.3 Using Material setProperty on Spine only take effect for the first time

Cocos

Hi, I am writing a simple shader for spine, and use ts code to animate that shader by setProperty function. The same logic work with sprite, but not Spine. Here is my demo TestShaderSpine.zip (5.3 How can I make setProperty work inside a tween?

Shaders 40
article thumbnail

Cocos 3.7.3 Using Material setProperty on Spine only take effect for the first time

Cocos

Hi, I am writing a simple shader for spine, and use ts code to animate that shader by setProperty function. The same logic work with sprite, but not Spine. Here is my demo TestShaderSpine.zip (5.3 How can I make setProperty work inside a tween?

Shaders 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