Remove Code Remove Scripting Remove Sprite
article thumbnail

Tag to prefab dynamically and intersect in script

Cocos

This is the Cocos2dx code snippet. I want to do this in the creator-type script. 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)) Kindly help.

article thumbnail

Noob question about scripting animation

Cocos

That being said, I’m trying to determine if I can do something a certain way, and, if so, can someone provide a basic example of what the code would look like? Currently, my client engineer has 5 cards being dealt and each card sprite pulls from a random card image on an atlas. So, I am trying to create a card flip effect.

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

2D gaming performance

Cocos

As soon as the script detects that a black screen will appear soon, the script generates ground. For now, I settled on the ground generation approach (piece of ground->bridge->piece of ground) At first I wanted to attach the code, but I think it would be better to try to explain the meaning of the generation.

Sprite 52
article thumbnail

Shader doesn't work on brower, or run it in the editor

Cocos

Applying a gradient shader with 5 colors to the label works fine, but applying the same shader to the spirte doesn’t work, and the 2-color graident in the code I posted earlier doesn’t work either. Is there a difference between applying the material to the sprite and the label?

Shaders 52
article thumbnail

Question about PolygonCollider2D

Cocos

In the editor, when you add a PolygonCollider2D to a sprite with a transparent area, the polygon is automatically created. How can I get automatic polygon creation when creating a sprite dynamically in the script code? I will be grateful for your help!

Polygon 40
article thumbnail

Programming Neo6502 in C/C++ Using CC65

Retro Game Coders

Dungeon game written in C/C++ for the Neo6502 Bit of Background Before We Code the Neo6502 In my Neo6502 review I promised I would come back and write about how to code for the machine. Neo6502 emulator for macOS The second issue was which language should I code in? Get all the latest code and files on Github. Yes please!

Writing 116
article thumbnail

D20 RPG – Combatants

The Liquid Fire

We will add animated sprites to represent both a hero and monster. It includes a collection of prefabs, scripts and sprites that we can use to play with. New Sprites There are three new sprites included. Combatant View Open the new script at Assets -> Scripts -> SoloAdventure -> Encounter -> CombatantView.

Demo 52