Hi all, I am trying to make a very simple game similar to the iOS title Circle Stop.
I am quite new at coding so even that is difficult for me
I have a player moving automatically and several pickups on his path. All pickups are instances of the same prefab.
When the player is hitting one pickup, I want that pickup to scale up. I am using the code below.
I have a script on the player to detect collisions (ColCheck). I have a script on the pickup to transform its scale.
basically, the pickup script checks if the collision happened and scales the object.
function Update () {
if (hintCheck == ColCheck.pickupHit) {
transform.localScale = Vector2(2, 2);
}
}
the variables hintCheck and pickupHit allow me to see how many pickups were hit. Each pickup has a different value. The first has hintCheck = 1, the second hintCheck = 2 and so on… This way, each pickup should react independently.
As soon as the player hits the first pickup, all are scaled. This really surprised me as I used before transform.position and that only affected one pickup at a time.
Anybody knows what I am doing wrong?