Jump to content
Sign in to follow this  
Rux

Ansatsusha (暗殺者) - 3D Sniper game programmed in Autoit

Recommended Posts

Rux

I'd like to present a game I am working on called ANSATSUSHA (means assassin in Japanese).

So far, I'm still working on the first level, after having to overcome many problems, and I'm still not finished it. However, I have overcome most of the problems, and now I'm working on it rather than solving problems. I am using the IRRLICHT Autoit engine, autoit to program it, Anim8tor + an animator file to .ms3d converter to make the models. I'm already finished with all/most of the graphics making though.

ANSATSUSHA OVERVIEW

---------------------------------

The point of the game is to take the roll of an assassin. There will be 10 levels, with 5 different objectives. After beating the first 5, you will do the same objectives, but they will be harder. For now, I'm not going to spoil any of the missions, except the first 1 is just a standard aim and kill mission.

Download the first demo here V

http://adf.ly/80AKT

CONTROLS:

WASD - Walk

Left Mouse - Shoot

Right Mouse - Scope

Mouse - Aim

R - Reload

ALT - F4 (for now) Close out of the game. I haven't programmed a proper exit yet. It's coming soon though.

So far, all you can do is walk around and shoot, but its a start. Have fun.

post-62968-0-36602800-1329961705_thumb.j

post-62968-0-67206400-1329961710_thumb.j

Edited by Rux
  • Like 1

Share this post


Link to post
Share on other sites
BrewManNH

I ran this on Windows 7 last night and it immediately maxed out my volume control, I thought I was going to have a heart attack.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
ludocus

Apparently my pc is way to slow for this stuff. It makes my computer go crazy.

Share this post


Link to post
Share on other sites
Rux

I shoot and shoot but I can't kill the bird =/

Nice start :)

...bird? That's supposed to be an airplane.... LOL. Why would a bird have engines on it's tail?

Oh and sorry about the sound, I haven't used the sound system much so I'm unfamiliar with it. I think I know the problem though. I can fix it.

Cool, i can't believe it's done in autoit!

Any chance we get to see the au3 file? i'd be interrested to have a look :-)

If I finish the game, I might release the source. Once I finish level 1, I'm sure the rest of the level's will be half a snap to complete. I just need to set everything up in Level 1, while I'm still learning some things about Irrlicht.

Edited by Rux

Share this post


Link to post
Share on other sites
Rux

Sorry for no updates thus far. I'm currently stuck on putting in AI, and I'm actually working on something unrelated at the moment. So until I finish that, I can't work on this. I'll try to get to it as fast as possible.

Share this post


Link to post
Share on other sites
Skitty

Windows XP SP3

Error: This appplication failed to start because MSVCP71.dll was not found.

You should include it with the script if it's not found.

And another thing, how do you exit without having to reboot or access task manager and navigate it with your keyboard?

I couldn't figure it out and every time I brought up the task manager the course would not move from the top left side of the screen and had to terminate the process manually.


Things that I've done..

Icon Resource Editor: icon resource editor 

AutoIt Piano: a piano

AutoIt Unlocker: unlocks files when you want to delete them

Colorful tooltips: a wrapper for the tool tips UDF

Rouge GoogleBot: a full screen animation

ASciTE text editor: a text editor written in autoit

Warning: Posts by this user are subject to change or may disappear without notice.

Share this post


Link to post
Share on other sites
Rux

1. Look it up on the internet, those .dll files should be on your computer. It's probably cause you are using XP. Vista and 7 should already have it.

2. Also, I haven't programed an exit yet. Just use ALT-F4 to exit.

Edited by Rux

Share this post


Link to post
Share on other sites
Skitty

1. Look it up on the internet, those .dll files should be on your computer. It's probably cause you are using XP. Vista and 7 should already have it.

2. Also, I haven't programed an exit yet. Just use ALT-F4 to exit.

XP apparently doesn't come with the C++ runtime library, and I implied in the previous post that I had downloaded it since I obviously got to the point where I couldn't figure out how to exit the game while it was so resource raping on my little laptop. lol, I need a better pc... :oops:


Things that I've done..

Icon Resource Editor: icon resource editor 

AutoIt Piano: a piano

AutoIt Unlocker: unlocks files when you want to delete them

Colorful tooltips: a wrapper for the tool tips UDF

Rouge GoogleBot: a full screen animation

ASciTE text editor: a text editor written in autoit

Warning: Posts by this user are subject to change or may disappear without notice.

Share this post


Link to post
Share on other sites
wakillon

Nice Demo !

Works fine ( Xp Sp3 )

Thanks ! :oops:


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites
Rutger83

Yep works on my xp sp3 aswell. Very cool done

Share this post


Link to post
Share on other sites
FaridAgl

Nice job, working fine here at Win XP SP3.

You can use this great UDF to pack all of your file in "otherdata" folder to a package, then you can load your images and sounds directly from package ( from memory ).

Share this post


Link to post
Share on other sites
Rux

Because I feel bad for making you guys wait for another demo, here is the game's main source code. However, it would be quite difficult to post the whole thing as lots of the libraries are installed in my autoit, and I've added a few things to the au3Irrlicht2 library. In other words, this code will NOT work alone. But, it's for anyone who's interested. (Ignore the first part in the comments, this is just so I can run the level without having to start the game's menu)

;#comments-start
#include <au3Irrlicht2au3Irrlicht2.au3>
#include <Sound.au3>
#include <Misc.au3>
Global $driver = 2
Global $shadowy = 0
Global $pname = "TESTING"
LEVEL1()
;#comments-end
Func LEVEL1()
Local $l_driver = $driver
Local $l_shadows = $shadowy

Local $keydll = DllOpen("user32.dll")
Local $Wkey = 57, $Skey = 53, $AKey = 41, $Dkey = 44, $ESCkey = "1B", $LMouse = 01, $RMouse = 02, $EnterKey = "0D", $Rkey = "52"

Local $IsPaused = 0
Local $IsSnipeMode = 0
Local $eventtimer
Local $controlsActive = 0
Local $finalresult = 0

Switch $l_driver
  Case 0
   $l_driver = $IRR_EDT_OPENGL
  Case 1
   $l_driver = $IRR_EDT_DIRECT3D8
  Case 2
   $l_driver = $IRR_EDT_DIRECT3D9
EndSwitch
Switch $l_shadows
  Case 0
   $l_shadows = $IRR_SHADOWS
  Case 1
   $l_shadows = $IRR_NO_SHADOWS
EndSwitch
 

_IrrStart($l_driver, 800, 600, $IRR_BITS_PER_PIXEL_32, $IRR_FULLSCREEN, $l_shadows)
_IrrSetWindowCaption($pname)
_IrrDisplayMouse(False)

_IrrAddZipFile("data.dat", $IRR_IGNORE_CASE, $IRR_IGNORE_PATHS)

Local $screens[4] ;0 = Loading 1 = Pause, 2 = Victory, 3 = Fail
$screens[0] = _IrrGetTexture("loadingScreen.jpg")
_IrrBeginScene(0,0,0)
_IrrDraw2DImage($screens[0], 0, 0)
_IrrEndScene()
$screens[1] = _IrrGetTexture("pauseScreen.jpg")
$screens[2] = _IrrGetTexture("victoryScreen.jpg")
$screens[3] = _IrrGetTexture("failureScreen.jpg")

Local $texturebank[8] ;0 = Airport Building, 1 = Cement, 2 = Sniper Texture, 3 = Airport Tower Texture, 4 = ClipTexture, 5 = PlaneTexture, 6 = Black Texture, 7 = Bullet Texture
$texturebank[0] = _IrrGetTexture("airportbuildingTxt1.jpg")
$texturebank[1] = _IrrGetTexture("cement.jpg")
$texturebank[2] = _IrrGetTexture("sniperTxt.jpg")
$texturebank[3] = _IrrGetTexture("airportTowerTxt.jpg")
$texturebank[4] = _IrrGetTexture("clipB.jpg")
$texturebank[5] = _IrrGetTexture("planeTxt.jpg")
$texturebank[6] = _IrrGetTexture("blackTxt.jpg")
$texturebank[7] = _IrrGetTexture("bullettxt.png")

Local $skydometxt = _IrrGetTexture("DayDome.jpg")

Local $particletxt[6]
$particletxt[0] = _IrrGetTexture("blood1.png")
$particletxt[1] = _IrrGetTexture("blood2.png")
$particletxt[2] = _IrrGetTexture("blood3.png")
$particletxt[3] = _IrrGetTexture("blood4.png")
$particletxt[4] = _IrrGetTexture("blood5.png")
$particletxt[5] = _IrrGetTexture("smoke.bmp")

Local $guitxt[5] ;0 = Crosshair, 1 = Scope, 2 = SniperIcon, 3 = Mission Text , 4 = Font
$guitxt[0] = _IrrGetTexture("cHair.png")
$guitxt[1] = _IrrGetTexture("scope.png")
$guitxt[2] = _IrrGetTexture("snipericon.png")
$guitxt[3] = _IrrGetTexture("m1obj.png")
$guitxt[4] = _IrrGetFont("Bitmapfont.xml")

Local $meshes[11]
$meshes[0] = _IrrGetMesh("airPlane.obj") ; Airplane
$meshes[1] = _IrrGetMesh("airportBuilding.obj") ; Airport Building
$meshes[2] = _IrrGetMesh("airportTower.obj") ; Airport Tower
$meshes[3] = _IrrGetMesh("bulletShell.obj") ; Bullet Shell
$meshes[4] = _IrrGetMesh("ground1.obj") ; The ground
$meshes[5] = _IrrGetMesh("humanTarget.ms3d") ; Human Target
$meshes[6] = _IrrGetMesh("playerArms.ms3d") ; Player Arms
$meshes[7] = _IrrGetMesh("playerBody.ms3d") ; Player Body
$meshes[8] = _IrrGetMesh("playerHead.obj") ; Player Head
$meshes[9] = _IrrGetMesh("sniper.obj") ; Sniper
$meshes[10] = _IrrGetMesh("sniperClip.obj") ; Sniper's Clip

Local $sounds[12]
$sounds[0] = ".otherdatablood1.wav"
$sounds[1] = ".otherdatablood2.wav"
$sounds[2] = ".otherdatablood3.wav"
$sounds[3] = ".otherdataclipSnap.wav"
$sounds[4] = ".otherdatamanDie.wav"
$sounds[5] = ".otherdatasnipe1.wav"
$sounds[6] = ".otherdatasnipe2.wav"
$sounds[7] = ".otherdatasnipe3.wav"
$sounds[8] = ".otherdatastep1.wav"
$sounds[9] = ".otherdatastep2.wav"
$sounds[10] = ".otherdatatrafficAmbience.mp3"
$sounds[11] = ".otherdataplaneext.wav"

;LOAD LEVEL
Local $nodebank[20]
Local $playernodes[5]
Local $bulletshell
Local $bulleteject
Local $barrelsmoke
Local $cameras[2]
Local $lights
Local $skydomenode
Local $bgsound
Local $objective[2]
Local $collidebank[2]
Local $walkspeed = 0.5
Local $animswitch = 0
Local $animsoundswitch = 0
Local $rotatespeed = 100
Local $rdif[2]
Local $camfix = 0
Local $guinodes[3]
Local $zoom = 0
Local $zoomswitch = 0
Local $gunanimstate = 0 ; 0 = Idle, 1 = Fire, 2 = Reload, 3 = (Hold Anim)
Local $recoilmove = 0

Local $camfromvector[3]
Local $camtovector[3]
Local $camvectorresult[3]
Local $raytarg
Local $mapcollisiongroup = _IrrCreateCombinedCollisionGroup()

Local $ammo[2], $goal[2], $maxclip = 5
$ammo[0] = 5
$ammo[1] = 10
$goal[0] = 0
$goal[1] = 10

$cameras[0] = _IrrAddCamera(0, 120, 500, 10, 100, 0) ;Revolving
_IrrAddFlyCircleAnimator($cameras[0], -10, 100, 0, 500, -0.0001)
$cameras[1] = _IrrAddFPSCamera("", $rotatespeed, 0)
_IrrSetCameraTarget($cameras[1], 100, 150, 20)
_IrrSetActiveCamera($cameras[0])

$skydomenode = _IrrAddSkyDomeToScene($skydometxt, 10, 16, 1, 1.1, 1000)
$lights = _IrrAddLight($IRR_NO_PARENT, 0, 5000, 0, 255, 255, 255, 10000)
_IrrSetAmbientLight(.5, .5, .5)

$nodebank[0] = _IrrAddMeshToScene($meshes[4]) ;Ground
_IrrSetNodeMaterialTexture($nodebank[0], $texturebank[1], 0)
_IrrSetNodeMaterialFlag($nodebank[0], $IRR_EMF_NORMALIZE_NORMALS, $IRR_ON)
_IrrSetNodePosition($nodebank[0], 0,-10,0)
_IrrSetNodeScale($nodebank[0], 30, 1, 30)
_IrrAddCollisionGroupToCombination($mapcollisiongroup, _IrrGetCollisionGroupFromMesh($meshes[4], $nodebank[0], 0))

$nodebank[1] = _IrrAddMeshToScene($meshes[2]) ;Sniper tower
_IrrSetNodeMaterialTexture($nodebank[1], $texturebank[3], 0)
_IrrSetNodePosition($nodebank[1], -10,50,0)
_IrrSetNodeScale($nodebank[1], 1, 1, 1)
$collidebank[0] = _IrrGetCollisionGroupFromMesh($meshes[2], $nodebank[1], 0)
_IrrAddCollisionGroupToCombination($mapcollisiongroup, $collidebank[0])

$nodebank[2] = _IrrAddMeshToScene($meshes[1]) ;Airport Buildings
_IrrSetNodeMaterialTexture($nodebank[2], $texturebank[0], 0)
_IrrSetNodePosition($nodebank[2], 2000,30,500)
_IrrAddNodeShadow($nodebank[2])
_IrrAddCollisionGroupToCombination($mapcollisiongroup, _IrrGetCollisionGroupFromMesh($meshes[1], $nodebank[2], 0))
$nodebank[3] = _IrrAddMeshToScene($meshes[1])
_IrrSetNodeMaterialTexture($nodebank[3], $texturebank[0], 0)
_IrrSetNodePosition($nodebank[3], 1800,30,500)
_IrrAddNodeShadow($nodebank[3])
_IrrAddCollisionGroupToCombination($mapcollisiongroup, _IrrGetCollisionGroupFromMesh($meshes[1], $nodebank[3], 0))
$nodebank[4] = _IrrAddMeshToScene($meshes[1])
_IrrSetNodeMaterialTexture($nodebank[4], $texturebank[0], 0)
_IrrSetNodePosition($nodebank[4], 1600,30,500)
_IrrAddNodeShadow($nodebank[4])
_IrrAddCollisionGroupToCombination($mapcollisiongroup, _IrrGetCollisionGroupFromMesh($meshes[1], $nodebank[4], 0))
$nodebank[5] = _IrrAddMeshToScene($meshes[1])
_IrrSetNodeMaterialTexture($nodebank[5], $texturebank[0], 0)
_IrrSetNodePosition($nodebank[5], 1400,30,500)
_IrrAddNodeShadow($nodebank[5])
_IrrAddCollisionGroupToCombination($mapcollisiongroup, _IrrGetCollisionGroupFromMesh($meshes[1], $nodebank[5], 0))
$nodebank[6] = _IrrAddMeshToScene($meshes[1])
_IrrSetNodeMaterialTexture($nodebank[6], $texturebank[0], 0)
_IrrSetNodePosition($nodebank[6], 1200,30,500)
_IrrAddNodeShadow($nodebank[6])
_IrrAddCollisionGroupToCombination($mapcollisiongroup, _IrrGetCollisionGroupFromMesh($meshes[1], $nodebank[6], 0))

$nodebank[7] = _IrrAddMeshToScene($meshes[1])
_IrrSetNodeMaterialTexture($nodebank[7], $texturebank[0], 0)
_IrrSetNodePosition($nodebank[7], 2000,30,-500)
_IrrAddNodeShadow($nodebank[7])
_IrrAddCollisionGroupToCombination($mapcollisiongroup, _IrrGetCollisionGroupFromMesh($meshes[1], $nodebank[7], 0))
$nodebank[8] = _IrrAddMeshToScene($meshes[1])
_IrrSetNodeMaterialTexture($nodebank[8], $texturebank[0], 0)
_IrrSetNodePosition($nodebank[8], 1800,30,-500)
_IrrAddNodeShadow($nodebank[8])
_IrrAddCollisionGroupToCombination($mapcollisiongroup, _IrrGetCollisionGroupFromMesh($meshes[1], $nodebank[8], 0))
$nodebank[9] = _IrrAddMeshToScene($meshes[1])
_IrrSetNodeMaterialTexture($nodebank[9], $texturebank[0], 0)
_IrrSetNodePosition($nodebank[9], 1600,30,-500)
_IrrAddNodeShadow($nodebank[9])
_IrrAddCollisionGroupToCombination($mapcollisiongroup, _IrrGetCollisionGroupFromMesh($meshes[1], $nodebank[9], 0))
$nodebank[10] = _IrrAddMeshToScene($meshes[1])
_IrrSetNodeMaterialTexture($nodebank[10], $texturebank[0], 0)
_IrrSetNodePosition($nodebank[10], 1400,30,-500)
_IrrAddNodeShadow($nodebank[10])
_IrrAddCollisionGroupToCombination($mapcollisiongroup, _IrrGetCollisionGroupFromMesh($meshes[1], $nodebank[10], 0))
$nodebank[11] = _IrrAddMeshToScene($meshes[1])
_IrrSetNodeMaterialTexture($nodebank[11], $texturebank[0], 0)
_IrrSetNodePosition($nodebank[11], 1200,30,-500)
_IrrAddNodeShadow($nodebank[11])
_IrrAddCollisionGroupToCombination($mapcollisiongroup, _IrrGetCollisionGroupFromMesh($meshes[1], $nodebank[11], 0))

$nodebank[12] = _IrrAddMeshToScene($meshes[0]) ;Airplanes
_IrrSetNodeMaterialTexture($nodebank[12], $texturebank[5], 0)
_IrrSetNodePosition($nodebank[12], 700,40,270)
_IrrSetNodeRotation($nodebank[12], 0, 200, 0)
_IrrAddNodeShadow($nodebank[12])
_IrrAddCollisionGroupToCombination($mapcollisiongroup, _IrrGetCollisionGroupFromMesh($meshes[0], $nodebank[12], 0))

$nodebank[13] = _IrrAddMeshToScene($meshes[0])
_IrrSetNodeMaterialTexture($nodebank[13], $texturebank[5], 0)
_IrrSetNodePosition($nodebank[13], 2500,40,-320)
_IrrSetNodeRotation($nodebank[13], 0, 0, 0)
_IrrAddNodeShadow($nodebank[13])
_IrrAddCollisionGroupToCombination($mapcollisiongroup, _IrrGetCollisionGroupFromMesh($meshes[0], $nodebank[13], 0))

$nodebank[14] = _IrrAddMeshToScene($meshes[0]) ;Flying Airplane
_IrrSetNodeMaterialTexture($nodebank[14], $texturebank[5], 0)
_IrrSetNodePosition($nodebank[14], 2000, 1000, -2000)
_IrrSetNodeRotation($nodebank[14], 0, 0, 0)
_IrrSetNodeScale($nodebank[14], 0.3, 0.3, 0.3)
_IrrAddNodeShadow($nodebank[14])
Local $psoundloop = 2800

;BEGIN PLAYER SETUP
Local $playerjoints[4]

$playernodes[0] = _IrrAddMeshToScene($meshes[8]) ;HEAD
_IrrSetNodeMaterialTexture($playernodes[0], $texturebank[6], 0)
_IrrSetNodeMaterialFlag($playernodes[0], $IRR_EMF_LIGHTING, $IRR_OFF)
_IrrSetNodeScale($playernodes[0], 0.45, 0.45, 0.45)
_IrrSetNodePosition($playernodes[0], 0, 0, 0)
_IrrSetNodeRotation($playernodes[0], 0, 0, 0)
$raytarg = _IrrAddSphereSceneNode(0.0000001, 3)
_IrrAddChildToParent($raytarg, $cameras[1])
_IrrSetNodePosition($raytarg, 60,-60,3000)


$playernodes[1] = _IrrAddMeshToScene($meshes[7]) ;BODY
_IrrSetNodeMaterialTexture($playernodes[1], $texturebank[6], 0)
_IrrSetNodeMaterialFlag($playernodes[1], $IRR_EMF_LIGHTING, $IRR_OFF)
_IrrSetNodeScale($playernodes[1], 0.45, 0.45, 0.45)
_IrrSetNodePosition($playernodes[1], -10, 115, 20)
_IrrSetNodeRotation($playernodes[1], 0, -90, 0)
_IrrAddNodeShadow($playernodes[1])
_IrrSetNodeAnimationRange($playernodes[1], 0, 0)
_IrrSetNodeAnimationSpeed($playernodes[1], 0)
_IrrSetTransitionTime($playernodes[1], 0.05)
$playerjoints[0] = _IrrGetJointNode($playernodes[1], "headjoint")
$playerjoints[1] = _IrrGetJointNode($playernodes[1], "upperback")
$collidebank[1] = _IrrAddCollisionAnimator($collidebank[0], $playernodes[1], 3, 1, 3, 0, -9.8, 0, 0, -5.5, 0)

$playernodes[2] = _IrrAddMeshToScene($meshes[6]) ;ARMS
_IrrSetNodeMaterialTexture($playernodes[2], $texturebank[6], 0)
_IrrSetNodeMaterialFlag($playernodes[2], $IRR_EMF_LIGHTING, $IRR_OFF)
_IrrSetNodeScale($playernodes[2], 0.3, 0.3, 0.3)
_IrrSetNodePosition($playernodes[2], 0, -7, 0)
_IrrSetNodeRotation($playernodes[2], 0, 180, 0)
_IrrSetNodeAnimationRange($playernodes[2], 0, 2)
_IrrSetNodeAnimationSpeed($playernodes[2], 2)
_IrrSetTransitionTime($playernodes[2], 0.000005)
$playerjoints[2] = _IrrGetJointNode($playernodes[2], "lowerrightarm")
$playerjoints[3] = _IrrGetJointNode($playernodes[2], "lowerleftarm")

$playernodes[3] = _IrrAddMeshToScene($meshes[9]) ;SNIPER
_IrrSetNodeMaterialTexture($playernodes[3], $texturebank[2], 0)
_IrrSetNodeMaterialFlag($playernodes[3], $IRR_EMF_LIGHTING, $IRR_OFF)
_IrrSetNodeScale($playernodes[3], 0.8, 0.8, 0.8)
_IrrSetNodeRotation($playernodes[3], 0, 180, -90)
_IrrSetNodePosition($playernodes[3], 7, 0, -40)
$bulleteject = _IrrAddSphereSceneNode(5, 3)
_IrrAddChildToParent($bulleteject, $playernodes[3])
_IrrSetNodePosition($bulleteject, 5,0,-35)
_IrrSetNodeVisibility($bulleteject, False)
$barrelsmoke = _IrrAddSphereSceneNode(0.0001, 3)
_IrrAddChildToParent($barrelsmoke, $playernodes[3])
_IrrSetNodePosition($barrelsmoke, -1,0,11)


$playernodes[4] = _IrrAddMeshToScene($meshes[10]) ;SNIPER CLIP
_IrrSetNodeMaterialTexture($playernodes[4], $texturebank[4], 0)
_IrrSetNodeMaterialFlag($playernodes[4], $IRR_EMF_LIGHTING, $IRR_OFF)
_IrrSetNodeScale($playernodes[4], 0.8, 0.8, 0.8)
_IrrSetNodeRotation($playernodes[4], 0, 0, 0)
_IrrSetNodePosition($playernodes[4], 0, -3, -35)

_IrrAddChildToParent($playernodes[2], $playernodes[1])
_IrrSetNodePosition($cameras[1], 0,0,0)
_IrrAddChildToParent($playernodes[3], $playerjoints[2])
_IrrAddChildToParent($playernodes[4], $playernodes[3])
;END PLAYER SETUP

$bgsound = _GEng_Sound_Load($sounds[10], 1)
_GEng_Sound_Play($bgsound)

$eventtimer = TimerInit()

While _IrrRunning()

;HANDLEPLANE START
if TimerDiff($psoundloop) >= 2800 Then
  $psoundloop = TimerInit()
  $i = _IrrGetNodePosition($nodebank[14])
  if $IsSnipeMode = 0 Then
   _IEA_3Dsound($cameras[0], $i[0], $i[1], $i[2], $sounds[11], 3000)
  Else
   _IEA_3Dsound($cameras[1], $i[0], $i[1], $i[2], $sounds[11], 3000)
  endif
endif
$i = _IrrGetNodePosition($nodebank[14])
_IrrSetNodePosition($nodebank[14], $i[0], $i[1], $i[2] + 0.5)
if $i[2] >= 3500 Then
  $j = Random(1000, 3000)
  _IrrSetNodePosition($nodebank[14], $j, $i[1], -5000)
endif
;HANDLEPLANE END

if TimerDiff($eventtimer) >= 3000 AND $IsSnipeMode = 0 Then
   if $objective[1] = 0 Then
    $objective[0] = _IrrAddBillBoardToScene(991, 121)
    _IrrSetNodeMaterialTexture($objective[0], $guitxt[3], 0)
    _IrrSetNodeMaterialFlag($objective[0], $IRR_EMF_LIGHTING, $IRR_OFF)
    _IrrAddChildToParent($objective[0], $playernodes[1])
    _IrrSetNodePosition($objective[0], 0, 500, -60)
    _IrrSetNodeMaterialType($objective[0], $IRR_EMT_TRANSPARENT_ALPHA_CHANNEL)
    $objective[1] = 1
   endif
   if _IsPressed($EnterKey, $keydll) = 1 Then
    $IsSnipeMode = 1
    $controlsactive = 1
    _IrrRemoveNode($objective[0])
    _IrrSetActiveCamera($cameras[1])
    _IrrAddChildToParent($playernodes[2], $cameras[1])
    $guinodes[0] = _IrrAddImage($guitxt[2], 650, 510, $IRR_USE_ALPHA, 0)
    $i = _IrrGetNodePosition($playernodes[3])
    _IEA_3Dsound($cameras[1], $i[0], $i[1], $i[2], $sounds[3], 300)
   EndIf
endif

;Controls
if $controlsactive = 1 Then
  if _IsPressed($RMouse, $keydll) = 1 AND $zoomswitch = 0 Then
   if $zoom = 0 Then
    $zoom = 1
   else
    $zoom = 0
   EndIf
   $zoomswitch = 1
  EndIf
  if _IsPressed($RMouse, $keydll) = 0 Then
   $zoomswitch = 0
  endif
  if _IsPressed($LMouse, $keydll) = 1 Then
   if $ammo[0] > 0 Then
    $gunanimstate = 1
    $controlsactive = 2
    $ammo[0] -= 1
    $j = Round(Random(0, 2))
    $i = _IrrGetNodePosition($cameras[0])
    if $j = 0 Then
     _IEA_3Dsound($cameras[1], $i[0], $i[1], $i[2], $sounds[5], 1000)
    elseif $j = 1 Then
     _IEA_3Dsound($cameras[1], $i[0], $i[1], $i[2], $sounds[6], 1000)
    elseif $j = 2 Then
     _IEA_3Dsound($cameras[1], $i[0], $i[1], $i[2], $sounds[7], 1000)
    endif
    $camfromvector = _IrrGetNodeAbsolutePosition($cameras[1])
    $camtovector = _IrrGetNodeAbsolutePosition($raytarg)
    $camvectorresult = ""
    if _IrrGetCollisionPoint($camfromvector, $camtovector, $mapcollisiongroup, $camvectorresult) Then
    
    endif
   endif
  endif
  if _IsPressed($Rkey, $keydll) = 1 Then
   if $ammo[0] <> $maxclip AND $ammo[1] > 0 Then
    $gunanimstate = 2
    $controlsactive = 2
    $zoom = 0
   EndIf
  endif
endif
if $controlsactive = 1 OR $controlsactive = 2 Then
 
  if _IsPressed($Wkey, $keydll) = 1 Then
   if $animswitch = 0 Then
    _IrrSetNodeAnimationRange($playernodes[1], 4, 17)
    _IrrSetNodeAnimationSpeed($playernodes[1], 15)
    $animswitch = 1
   endif
   $i = _IrrGetNodeRotation($playernodes[1])
   $i2 = _IrrGetNodePosition($playernodes[1])
   $xxx = $walkspeed * sin(($i[1] * 3.14) / 180)
   $zzz = $walkspeed * cos(($i[1] * 3.14) / 180)
   _IrrSetNodePosition($playernodes[1], $i2[0] - $xxx, $i2[1], $i2[2] - $zzz)
  
   $s = _IrrGetNodeAnimationFrame($playernodes[1])
   $i2 = _IrrGetNodePosition($cameras[1])
   if $s = 4 OR $s = 11 OR $s = 18 AND $animsoundswitch = 0 Then
    if Round(Random(0,1)) = 0 Then
     _IEA_3Dsound($cameras[1], $i2[0], $i2[1], $i2[2], $sounds[8], 300)
     $animsoundswitch = 1
    Else
     _IEA_3Dsound($cameras[1], $i2[0], $i2[1], $i2[2], $sounds[9], 300)
     $animsoundswitch = 1
    EndIf
   Else
    $animsoundswitch = 0
   endif
  endif
 
  if _IsPressed($Skey, $keydll) = 1 Then
   if $animswitch = 0 Then
    _IrrSetNodeAnimationRange($playernodes[1], 4, 17)
    _IrrSetNodeAnimationSpeed($playernodes[1], -15)
    $animswitch = 1
   endif
   $i = _IrrGetNodeRotation($playernodes[1])
   $i2 = _IrrGetNodePosition($playernodes[1])
   $xxx = $walkspeed * sin(($i[1] * 3.14) / 180)
   $zzz = $walkspeed * cos(($i[1] * 3.14) / 180)
   _IrrSetNodePosition($playernodes[1], $i2[0] + $xxx, $i2[1], $i2[2] + $zzz)
  
   $s = _IrrGetNodeAnimationFrame($playernodes[1])
   $i2 = _IrrGetNodePosition($cameras[1])
   if $s = 4 OR $s = 11 OR $s = 18 AND $animsoundswitch = 0 Then
    if Round(Random(0,1)) = 0 Then
     _IEA_3Dsound($cameras[1], $i2[0], $i2[1], $i2[2], $sounds[8], 300)
     $animsoundswitch = 1
    Else
     _IEA_3Dsound($cameras[1], $i2[0], $i2[1], $i2[2], $sounds[9], 300)
     $animsoundswitch = 1
    EndIf
   Else
    $animsoundswitch = 0
   endif
  endif
 
  if _IsPressed($Akey, $keydll) = 1 Then
   if $animswitch = 0 Then
    _IrrSetNodeAnimationRange($playernodes[1], 4, 17)
    _IrrSetNodeAnimationSpeed($playernodes[1], -15)
    $animswitch = 1
   endif
   $i = _IrrGetNodeRotation($playernodes[1])
   $i[1] = $i[1] + 90
   $i2 = _IrrGetNodePosition($playernodes[1])
   $xxx = $walkspeed * sin(($i[1] * 3.14) / 180)
   $zzz = $walkspeed * cos(($i[1] * 3.14) / 180)
   _IrrSetNodePosition($playernodes[1], $i2[0] + $xxx, $i2[1], $i2[2] + $zzz)
  
   $s = _IrrGetNodeAnimationFrame($playernodes[1])
   $i2 = _IrrGetNodePosition($cameras[1])
   if $s = 4 OR $s = 11 OR $s = 18 AND $animsoundswitch = 0 Then
    if Round(Random(0,1)) = 0 Then
     _IEA_3Dsound($cameras[1], $i2[0], $i2[1], $i2[2], $sounds[8], 300)
     $animsoundswitch = 1
    Else
     _IEA_3Dsound($cameras[1], $i2[0], $i2[1], $i2[2], $sounds[9], 300)
     $animsoundswitch = 1
    EndIf
   Else
    $animsoundswitch = 0
   endif
  endif
 
  if _IsPressed($Dkey, $keydll) = 1 Then
   if $animswitch = 0 Then
    _IrrSetNodeAnimationRange($playernodes[1], 4, 17)
    _IrrSetNodeAnimationSpeed($playernodes[1], -15)
    $animswitch = 1
   endif
   $i = _IrrGetNodeRotation($playernodes[1])
   $i[1] = $i[1] + 90
   $i2 = _IrrGetNodePosition($playernodes[1])
   $xxx = $walkspeed * sin(($i[1] * 3.14) / 180)
   $zzz = $walkspeed * cos(($i[1] * 3.14) / 180)
   _IrrSetNodePosition($playernodes[1], $i2[0] - $xxx, $i2[1], $i2[2] - $zzz)
  
   $s = _IrrGetNodeAnimationFrame($playernodes[1])
   $i2 = _IrrGetNodePosition($cameras[1])
   if $s = 4 OR $s = 11 OR $s = 18 AND $animsoundswitch = 0 Then
    if Round(Random(0,1)) = 0 Then
     _IEA_3Dsound($cameras[1], $i2[0], $i2[1], $i2[2], $sounds[8], 300)
     $animsoundswitch = 1
    Else
     _IEA_3Dsound($cameras[1], $i2[0], $i2[1], $i2[2], $sounds[9], 300)
     $animsoundswitch = 1
    EndIf
   Else
    $animsoundswitch = 0
   endif
  endif
 
  if _IsPressed($Wkey, $keydll) = 0 AND _IsPressed($Skey, $keydll) = 0 AND _IsPressed($Akey, $keydll) = 0 AND _IsPressed($Dkey, $keydll) = 0 Then
   if $animswitch = 1 Then
    _IrrSetNodeAnimationRange($playernodes[1], 0, 0)
    _IrrSetNodeAnimationSpeed($playernodes[1], 0)
    $animswitch = 0
   EndIf
  endif
endif

;Handle Animations
if $gunanimstate = 1 Then
  $gunanimstate = 3
  _IrrSetNodeAnimationRange($playernodes[2], 6, 14)
  _IrrSetNodeAnimationSpeed($playernodes[2], 12)
 
EndIf
if $gunanimstate = 2 Then
  $gunanimstate = 3
  _IrrSetNodeAnimationRange($playernodes[2], 20, 39)
  _IrrSetNodeAnimationSpeed($playernodes[2], 6)
endif

if _IrrGetNodeAnimationFrame($playernodes[2]) = 22 Then
  _IrrSetNodeAnimationFrame($playernodes[2], _IrrGetNodeAnimationFrame($playernodes[2]) + 1)
  $i2 = _IrrGetNodePosition($cameras[1])
  _IEA_3Dsound($cameras[1], $i2[0], $i2[1], $i2[2], $sounds[3], 1000)
  $ammo[0] = 0
  _IrrSetNodePosition($playernodes[4], -3,-3,0)
  _IrrSetNodeRotation($playernodes[4], 0, 90, 0)
  _IrrAddChildToParent($playernodes[4], $playerjoints[3])
EndIf
if _IrrGetNodeAnimationFrame($playernodes[2]) = 38 Then
  _IrrSetNodeAnimationFrame($playernodes[2], _IrrGetNodeAnimationFrame($playernodes[2]) + 1)
  $i2 = _IrrGetNodePosition($cameras[1])
  _IEA_3Dsound($cameras[1], $i2[0], $i2[1], $i2[2], $sounds[3], 1000)
  if $ammo[1] < $maxclip Then
   $ammo[0] = $ammo[1]
   $ammo[1] = 0
  else
   $ammo[0] = $maxclip
   $ammo[1] -= $maxclip
  endif
  _IrrAddChildToParent($playernodes[4], $playernodes[3])
  _IrrSetNodePosition($playernodes[4], 0, -3, -35)
  _IrrSetNodeRotation($playernodes[4], 0, 0, 0)
  $gunanimstate = 0
  _IrrSetNodeAnimationRange($playernodes[2], 0, 2)
  _IrrSetNodeAnimationSpeed($playernodes[2], 2)
  $controlsactive = 1
EndIf
 
if _IrrGetNodeAnimationFrame($playernodes[2]) = 10 Then ; BULLET SHELL
  if $bulletshell = "" Then
   $bulletshell = _IrrAddMeshToScene($meshes[3])
   $i2 = _IrrGetNodeAbsolutePosition($bulleteject)
   _IrrSetNodeMaterialTexture($bulletshell, $texturebank[7], 0)
   _IrrSetNodePosition($bulletshell, $i2[0], $i2[1], $i2[2])
   _IrrAddRotationAnimator($bulletshell, 0, 5, 0)
   _IrrSetNodeScale($bulletshell, .2, .2, .2)
   _IrrAddCollisionAnimator($collidebank[0], $bulletshell, 1,1,1, 0, -9.8, 0, 0,0,0)
   _IrrAddFadeAnimator($bulletshell, 2000, 0)
  endif
endif
if _IrrGetNodeAnimationFrame($playernodes[2]) = 13 Then
  $gunanimstate = 0
  _IrrSetNodeAnimationRange($playernodes[2], 0, 2)
  _IrrSetNodeAnimationSpeed($playernodes[2], 2)
  $controlsactive = 1
  $bulletshell = ""
endif
if _IrrGetNodeAnimationFrame($playernodes[2]) = 6 AND $zoom = 1 Then
  $recoilmove = 1
EndIf
if _IrrGetNodeAnimationFrame($playernodes[2]) = 8 AND $zoom = 1 Then
  $recoilmove = 2
EndIf
if _IrrGetNodeAnimationFrame($playernodes[2]) = 11 AND $zoom = 1 Then
  $recoilmove = 0
endif

;End Handle Animations

if $recoilmove = 1 Then
  $i = _IrrGetCameraTarget($cameras[1])
  _IrrSetCameraTarget($cameras[1], $i[0], $i[1] + 1, $i[2])
elseif $recoilmove = 2 Then
  $i = _IrrGetCameraTarget($cameras[1])
  _IrrSetCameraTarget($cameras[1], $i[0], $i[1] - 0.5, $i[2])
endif

$i = _IrrGetNodePosition($playernodes[1])
$i2 = _IrrGetNodeRotation($playernodes[1])
_IrrSetNodePosition($playernodes[0], $i[0], $i[1] + 35, $i[2])
_IrrSetNodePosition($cameras[1], $i[0], $i[1] + 30, $i[2])

if $IsSnipeMode = 1 Then
  $i3 = _IrrGetNodeRotation($cameras[1])
  $rdif[0] = $i3[1] - $rdif[1]
  _IrrSetNodeRotation($playernodes[1], $i2[0], $i2[1] + $rdif[0], $i2[2])
  $rdif[1] = $i3[1]
endif

if _IsPressed($ESCKey, $keydll) = 1 Then
  $IsPaused = 1
  Sleep(100)
endif


if $IsPaused = 1 Then
  $controlsactive = 0
  _IrrBeginScene(0,0,0)
  _IrrDraw2DImage($screens[1], 0, 0)
  _IrrEndScene()
  if _IsPressed($Enterkey, $keydll) = 1 Then
   $finalresult = 0
   ExitLoop
  EndIf
  if _IsPressed($ESCkey, $keydll) = 1 Then
   $IsPaused = 0
   if $IsSnipeMode = 1 Then
    $controlsactive = 1
   endif
   Sleep(100)
  EndIf
endif

if $IsPaused = 0 Then
_IrrBeginScene(180,255,255)

_IrrAnimateJoints($playernodes[1])
_IrrAnimateJoints($playernodes[2])
_IrrDrawScene()
if $zoom = 1 Then
  _IrrSetCameraFOV($cameras[1], 3.14 / 20.5)
  _IrrDraw2DImageElement($guitxt[1], -110, -100, 0, 0, 1000, 1000, $IRR_USE_ALPHA)
  _IrrSetNodeVisibility($playernodes[3], False)
  _IrrSetNodePosition($raytarg, 0,0,3000)
Else
  _IrrSetCameraFov($cameras[1], 3.14 / 2.5)
  _IrrSetNodeVisibility($playernodes[3], True)
  _IrrSetNodePosition($raytarg, 60,-60,3000)
endif
_IrrDrawGUI()
if $IsSnipeMode = 1 Then
  _Irr2DFontDraw($guitxt[4],$ammo[0] &"/"& $ammo[1] ,680, 550, 750, 780)
  _Irr2DFontDraw($guitxt[4], $goal[0] &"/"& $goal[1], 5, 10, 100, 100)
  _IrrDraw2DImageElement($guitxt[0], @DesktopWidth / 2, @DesktopHeight / 2, 0, 0, 18, 16, $IRR_USE_ALPHA)
endif
if $camfix = 0  AND  $i2[1] = 0 Then
  _IrrSetNodeRotation($playernodes[1], 0, -90, 0)
  $camfix = 1
endif

_IrrEndScene()
EndIf
WEnd
Return $finalresult

EndFunc

Share this post


Link to post
Share on other sites
Rux

Hey guys, I know this project is old, but I'm going to redo the whole game sometime in the future, now that I know a LOT more about the Irrlicht engine.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×