AGARIO Mechanichs
Hello everyone !
I'm stuck with this part of my game.
So if any of you have ever player the game AGARIO you'll know what I'm talking about. But if you haven't played it here is the effect I want to get.
My player is simply a sphere, I have other spheres in the game of different sizes. Right now I have it so that you can eat them and you'll get bigger but the problem is you can eat any size you want. What I want is so you can only eat your size and those lower than you. If the player tries to eat one bigger he/she should die.
So I guess I need a way of detecting if what I'm colliding with is bigger than me or smaller than me. If it's bigger I die, if it's smaller or same size I eat it.
Please guys those who want to help with code, write it in unity Java.
Thanks in advance ! I do like and respond to your comments !
PS: I'm not making a game like AGARIO just a mechanic like it.
Answer by ElementalVenom · Jan 02, 2016 at 04:06 AM
Should be fairly simple for you to port this to java but its in c#.
So you would want to do
if(collider.transform.size<transform.size){
//Eat him
}else{
//He eats you
}
This code, what function would it be under?
Collision Enter ?
Further more , what is size ? is this a variable I have to create ? If so what function should I give it ? What will it do ? I'm new to coding so I would appreciate if you are thorough with your explanations. Thanks in advance !
-Yas
Im sure you've figured this out by now(Sorry for the late reply) But size is a variable that is included in each transform.
Your answer
Follow this Question
Related Questions
Is there a way to see enemies highlighted through walls? 0 Answers
How to click on a GUILayout.Button that is already created 0 Answers
How do you script Beat Detection? 0 Answers
How to detect with colliders while drawing line by line renderer? 1 Answer
How can I stop the Camera from detecting things behind walls. 0 Answers