ok, so I've been trying to figure out how to solve this error for hours and I know it has something to do with the curly braces but I can't seem to pinpoint where. Any help is appreciated. The error is on my method line and all the methods after it. Thanks in advance.
using System;
using System.Collections.Generic;
using Sce.PlayStation.Core;
using Sce.PlayStation.Core.Environment;
using Sce.PlayStation.Core.Graphics;
using Sce.PlayStation.Core.Input;
using Sce.PlayStation.Core.Audio;
using System.Linq;
namespace Game2
{
public class AppMain
{
private static GraphicsContext graphics;
private static Texture2D BG;
private static Player hero, hero2;
private static Sprite back, back2;
private static Vector3 pos1,pos2,pos3,pos4,pos5,pos6,pos7,pos8,pos9;
private static bool running;
private static BgmPlayer bgmp;
private static List<Bullet> bullets;
private static List<Enemy> eList;
private static List<Player> pList;
public static void Main (string[] args)
{
Initialize ();
while (running) {
SystemEvents.CheckEvents ();
Update ();
Render ();
}
}
public static void Initialize ()
{
graphics = new GraphicsContext ();
pos1=new Vector3(100,400,0);
pos2=new Vector3(500,400,0);
pos3=new Vector3(100,100,0);
pos4=new Vector3(160,100,0);
pos5=new Vector3(220,100,0);
pos6=new Vector3(280,100,0);
pos7=new Vector3(340,100,0);
pos8=new Vector3(400,100,0);
pos9= new Vector3(460,100,0);
running=true;
pList= new List<Player>();
hero = new Player (1,graphics,pos2);
hero2 = new Player (2,graphics,pos1);
pList.Add (hero);
pList.Add (hero2);
eList= new List<Enemy>();
Enemy e1=new Enemy(graphics,pos3,0.1);
eList.Add(e1);
Enemy e2=new Enemy(graphics,pos4,0.2);
eList.Add(e2);
Enemy e3=new Enemy(graphics,pos5,0.3);
eList.Add(e3);
Enemy e4=new Enemy(graphics,pos6,0.4);
eList.Add(e4);
Enemy e5=new Enemy(graphics,pos7,0.5);
eList.Add(e5);
Enemy e6=new Enemy(graphics,pos8,0.6);
eList.Add(e6);
Enemy e7=new Enemy(graphics,pos9,0.7);
eList.Add(e7);
bullets = new List<Bullet>();
BG = new Texture2D ("/Application/Assets/Bckgd.png", false);
back = new Sprite (graphics, BG);
back.Position.X = 0;
back.Position.Y = 0;
back2 = new Sprite (graphics, BG);
back2.Position.X = 0;
back2.Position.Y = back.Height;
Bgm bgm = new Bgm("/Application/Assets/song.mp3");
bgmp = bgm.CreatePlayer();
bgmp.Loop=true;
bgmp.Play();
}
public static void Update ()
{
var gamePadData = GamePad.GetData (0);
if ((gamePadData.Buttons & GamePadButtons.Select) !=0)
{
running=false;
}
}
private static void PlayerReg()
{
foreach(Player k in pList)
{
k.Update(gamePadData);
}
}
private static void EnemReg()
{
foreach(Enemy z in eList){
z.Update();
}
}
private static void BulletReg()
{
foreach(Bullet b in bullets)
{
b.Update();
}
BulletReg();
EnemReg();
PlayerReg();
back.Position.Y--;
back2.Position.Y--;
if (back.Position.Y < -back.Height)
back.Position.Y = back.Height;
if (back2.Position.Y <= -back2.Height)
back2.Position.Y = back2.Height;
if ((gamePadData.Buttons & GamePadButtons.L) !=0)
{
Bullet b= new Bullet(graphics,hero.Pos);
bullets.Add (b);
}
if ((gamePadData.Buttons & GamePadButtons.R) !=0)
{
Bullet b= new Bullet(graphics,hero2.Pos);
bullets.Add(b);
}
}
}
}
public static void Render ()
{
graphics.SetClearColor (0.0f, 0.0f, 0.0f, 0.0f);
graphics.Clear ();
back.Render ();
back2.Render ();
foreach(Player k in pList){
k.Render();
}
foreach(Enemy z in eList){
z.Render();
}
foreach(Bullet b in bullets){
b.Render();
}
foreach(Bullet b in bullets)
{
b.Render();
}
graphics.SwapBuffers ();
public static void collisions()
{
for(int k=pList.Count-1;k>=0;k--)
{
for(int b=bullets.Count-1;b>=0;b--)
{
if (Vector3.Distance (pList[k].Center, bullets [b].Center) < pList[k].Radius+bullets [b].Radius)
{
bullets.RemoveAt(b);
break;
}
}
}
}
public void Collisions2()
{
for(int k=pList.Count-1;k>=0;k--)
{
for(int z=eList.Count-1;z>=0;z--)
{
if (Vector3.Distance(pList[k].Center, eList[z].Center)< pList[k].Radius+eList[z].Radius)
{
eList.RemoveAt(z);
pList.RemoveAt(k);
break;
}
}
}}}}