My first game - help

Irrlicht.Net is no longer developed or supported, Irrlicht.Net Cross Platform is a much more complete wrapper. Please ask your C# related questions on their forums first.
Locked
mklin
Posts: 2
Joined: Wed May 16, 2007 2:35 pm

My first game - help

Post by mklin »

Hello it is my first game as code below.
May you help me.
1. What way I can do and secure in the game before extending beyond map?
2. How to correct the move with cursor.Now is very dificult also with mouse? Perhaps only with mouse?

using System;
using Irrlicht;
using Irrlicht.Video;
using Irrlicht.Core;
using Irrlicht.Scene;

namespace Grax
{
class Gra
{
[STAThread]
static void Main(string[] args)
{
Gra mojaGra = new Gra();
mojaGra.uruchomGre();
}

public void uruchomGre()
{
// Utworzenie okna gry
IrrlichtDevice oknoGry = new IrrlichtDevice(DriverType.DIRECT3D9,
new Irrlicht.Core.Dimension2D(800, 600),
32,
false,
true,
false);

oknoGry.FileSystem.AddZipFileArchive(@"media\map-20kdm2.pk3");

IAnimatedMesh poziomGry = oknoGry.SceneManager.GetMesh("20kdm2.bsp");

ISceneNode wezelPoziomuGry = oknoGry.SceneManager.AddOctTreeSceneNode(poziomGry.GetMesh(0), null, 0);
wezelPoziomuGry.Position= new Vector3D(0,0,0);

ICameraSceneNode wezelKamery = oknoGry.SceneManager.AddCameraSceneNodeFPS(null, 100, 300, 0);
wezelKamery.Position = new Vector3D(1000, 400, 500);
wezelKamery.Rotation = new Vector3D(0,180, 0);

ITriangleSelector selektor = oknoGry.SceneManager.CreateOctTreeTriangleSelector(poziomGry.GetMesh(0), wezelPoziomuGry, 128);

ISceneNodeAnimator detektorKolizjiKamery = oknoGry.SceneManager.CreateCollisionResponseAnimator(
selektor,
wezelKamery,
new Vector3D(30, 40, 30),
new Vector3D(0, -1.0f, 0),
new Vector3D(0,15,0),
0);

wezelKamery.AddAnimator(detektorKolizjiKamery);

IAnimatedMeshSceneNode przeciwnik = oknoGry.SceneManager.AddAnimatedMeshSceneNode(
oknoGry.SceneManager.GetMesh(@"media\sydney.md2"),
null, 0);
przeciwnik.Position = new Vector3D(1000, 380, 400);

przeciwnik.SetMaterialTexture(0, oknoGry.VideoDriver.GetTexture(@"media\sydney.BMP"));
przeciwnik.SetMaterialFlag(MaterialFlag.LIGHTING, false);

przeciwnik.SetFrameLoop(320, 367);
przeciwnik.AnimationSpeed = 30;

ITriangleSelector przeciwnikSelektor = oknoGry.SceneManager.CreateOctTreeTriangleSelector(poziomGry.GetMesh(0), wezelPoziomuGry, 128);
ISceneNodeAnimator detektorKolizjiPrzeciwnika = oknoGry.SceneManager.CreateCollisionResponseAnimator(
przeciwnikSelektor,przeciwnik,new Vector3D(30,20,30), new Vector3D(0,-1.0f,0),new Vector3D(0,5,0),0);
przeciwnik.AddAnimator(detektorKolizjiPrzeciwnika);


bool firstTime = true;

while(oknoGry.Run())
{
if (oknoGry.WindowActive)
{
if (przeciwnik.Position.X<1500.0f)
{
przeciwnik.Position += new Vector3D(1.0f, 0, 0);
}
else
{
if (firstTime)
{
przeciwnik.SetFrameLoop(1, 319);
firstTime = false;
}
}


oknoGry.VideoDriver.BeginScene(true, true, new Color(0,200,200,200));
oknoGry.SceneManager.DrawAll();
oknoGry.VideoDriver.EndScene();

}
}

}
}
}
Locked