Yeah, there’s definitely some problems there. A few pieces of advice:
Don’t post images of your code - post the actual code using CODE tags
Line 15 defines a RemoveBlock method that takes no arguments, but then within that method ( at line 17 ) it attempts to redefine RemoveBlock with 2 float args. That’s a problem…
The tutorial you point to has a link to the completed code. Why not just use it? It doesn’t have the same issues as the above…
using UnityEngine;
using System.Collections;
public class ColliderExample : MonoBehaviour {
public GameObject terrain;
private PolygonGenerator tScrips;
public int size = 4;
public bool circular = false;
void Start () {
tScript = terrain.GetComponent ("PolygonGenerator") as PolygonGenerator;
}
bool RemoveBlock(float offsetX, float offsetY){
int x =Mathf.RoundToInt(transform.position.x+offsetX);
int y=Mathf.RoundToInt(transform.position.y+1f+offsetY);
if(x<tScript.blocks.GetLength(0) y<tScript.blocks.GetLength(1) x>=0 y>=0){
if(tScript.blocks[x,y]!=0){
tScript.blocks[x,y]=0;
return true;
}
}
return false;
}
void Update () {
bool collision=false;
for(int x=0;x<size;x++){
for(int y=0;y<size;y++){
if(circular){
if(Vector2.Distance(new Vector2(x-(size/2),y-(size/2)),Vector2.zero)<=(size/3)){
if(RemoveBlock(x-(size/2),y-(size/2))){
collision=true;
}
}
} else {
if(RemoveBlock(x-(size/2),y-(size/2))){
collision=true;
}
}
}
}
if( collision){
tScript.update=true;
}
}
}
Sorry I though I had put it in the Tags.
All of my errors are fixed now, thank you very much!! I’ll try to expand my knowledge of the Code/Errors/Forums. I’m new to all of the coding, and stuff.