Comments (7)
just wanted to say thanks for this post! super helpful, and very clean and understandable code. This was a great alternative to the spaghetti mess I had created, and I love the way you handled the blinking effect, even if that's not how I'm doing it in my game (changing the material instead of the scale, but it works fine if I follow your steps)
from aleksandrhovhannisyan.com.
this was really helpful to me, thank you
though Im having an issue with the model scale in the flash. Somehow the scale increase after the flash and stay that way in the others, the video explains it better
unitygame.mp4
from aleksandrhovhannisyan.com.
@fede7218 What is your model's initial scaling factor? I'm guessing it's not set to 1
, so ScaleModelTo(Vector3.one)
causes it to become larger than its initial size once invulnerability kicks in. Instead of scaling by one, it may be better to read the model's initial scale and alternate between zero and that value.
from aleksandrhovhannisyan.com.
@stilestr Glad it helped! And that sounds like a clever solution—I hadn't considered that, but it's probably much safer than scaling the model.
from aleksandrhovhannisyan.com.
This was super helpful!!
from aleksandrhovhannisyan.com.
This works really well in my 2D Platformer but unfortunately when I ran the code in Unity in 2D my player sprite falls through the floor when he gets hit and flashes. I'm wondering how it can be tweaked so that the sprite doesn't fall through the ground when he takes a hit but can still phase through enemy sprites
2023-08-14.21-19-49.mp4
from aleksandrhovhannisyan.com.
@Morkhelt Hard to say, but my article cautions that you should scale the sprite and not the entire character model; scaling the latter can break collision detection, which I suspect is what is happening here.
from aleksandrhovhannisyan.com.
Related Issues (20)
- Writing Better CSS HOT 7
- Creating a Fluid Type Scale with CSS Clamp HOT 17
- HTML Input Validation Without a Form HOT 1
- copyCode.js error in line: const code = codeBlocks[index].innerText; HOT 1
- Comments are getting truncated after 30 HOT 2
- Design Mode in 11ty HOT 2
- Image attribution not displaying HOT 1
- Feature Request: Front Matter Format For Local Image HOT 1
- Creating an Accessible Image Carousel HOT 10
- Feature Request: Order comments from older to newer HOT 1
- Lamp icon use? HOT 2
- figure.html params
- postImage.html params
- postImage.html params HOT 2
- RSS feed issue HOT 6
- After endless search I found this article. A lifesaver! Thanks
- Sprite Blinking Not Working HOT 2
- Works but how do I tweak it for 2D Platforming?
- are there any advantages to using cqi instead of vw HOT 1
- The Perfect Theme Switch Component
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aleksandrhovhannisyan.com.