Skocz do zawartości
  • 👋 Witaj na MPCForum!

    Przeglądasz forum jako gość, co oznacza, że wiele świetnych funkcji jest jeszcze przed Tobą! 😎

    • Pełny dostęp do działów i ukrytych treści
    • Możliwość pisania i odpowiadania w tematach
    • System prywatnych wiadomości
    • Zbieranie reputacji i rozwijanie swojego profilu
    • Członkostwo w jednej z największych społeczności graczy

    👉 Dołączenie zajmie Ci mniej niż minutę – a zyskasz znacznie więcej!

    Zarejestruj się teraz

Xanthous Man - wersja Irrlicht 2D


Rekomendowane odpowiedzi

Opublikowano

Witam , postanowiłem,że przepisze Xanthous'a z wersji zbugowanej i pisanej przez createpic na wersję Irrlicht . Może komuś posluży za pomoc w nauce tego UDF :)

Dodałem dźwięki , moby dalej latają jak głupie jednak może się pokusze na jakieś proste dodanie 'rozumowania' . Do tego jest blad przy wychodzeniu, zawsze zamyka cala gre. Ale to nie migajace czy znikajace potwory jak w poprzedniej wersji wiec mysle ze nie utrudni gry a może nawet zabawy :)

Oto kod:

 

 

   
#include "au3Irrlicht2.au3"
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <Misc.au3>
#include <StaticConstants.au3>
#include <GDIPlus.au3>
#include <array.au3>
#include <sound.au3>
HotKeySet("{END}", 'test')
HotKeySet('{RIGHT}', 'prawo')
HotKeySet('{left}', 'lewo')
HotKeySet('{up}', 'gora')
HotKeySet('{down}', 'dol')


DIM $IrrlichtLogo ; irr_texture
DIM $FreeBasicLogo ; irr_texture
DIM $FBIDELogo ; irr_texture
DIM $CodeBlocksLogo ; irr_texture
DIM $WrapperLogo ; irr_texture
DIM $screen_width ; integer
DIM $screen_height ; integer
$screen_width = 800
$screen_height = 650


;GFX:
$gfx1 = "GFX\bonus.mp3"
$gfx2 = "GFX\gameover.wav"
$gfx3 = "GFX\tlo1.mp3" ;moze kiedys
$gfx4 = "GFX\tlo2.mp3" ;moze kiedys
$gfx5 = "GFX\punkt.wav"
$gfx6 = "GFX\lvl.wav"
$gfx7 = "GFX\oslona.wav"
$gfx8 = "GFX\endimmortal.wav"

;==> /GFX
dim $p[3]
dim $mob[3]
dim $mob2[3]
$p[0] = Random(0, 750, 1)
$p[1] = Random(0, 650, 1)
$mob[0] = Random(0, 750, 1)
$mob[1] = Random(0, 650, 1)
$mob2[0] = Random(0, 750, 1)
$mob2[1] = Random(0, 650, 1)

$punkty = 0
$poziom = 0
$item = 0
$ogolempunktow = 0
$bonusodblokuj = 0
$tarcza = 0
$oslona = 0
$oslonaodblokuj = 0
$immortal = 0

$dodatek = 2
$wspolczynniklvl = 0.4 ;predkosc moba. ma rosnac wraz z lvlem
$wspolczynniklvlpostac = $wspolczynniklvl + $dodatek


menu()

func glowny()
_IrrStart($IRR_EDT_OPENGL, $screen_width, $screen_height, $IRR_BITS_PER_PIXEL_32, _
$IRR_WINDOWED, $IRR_NO_SHADOWS, $IRR_IGNORE_EVENTS, $IRR_VERTICAL_SYNC_ON) ;dzialanie skryptu o jakies 200% przyspieszy usuniecie parametrow ale za pozno sie obejrzalem i nie chcialem juz kombinowac znowu z predkoscia mobow do lvli
_IrrSetWindowCaption("XanthousMan")

;tekstury:

Global $b = _IrrGetTexture("bitmapy/kulka.bmp") ;bhater
Global $mob1 = _IrrGetTexture("bitmapy/mob1.bmp")
Global $mob3 = _IrrGetTexture("bitmapy/mob2.bmp")
Global $bonus = _IrrGetTexture("bitmapy/bonus.bmp")
Global $oslonatex = _IrrGetTexture("bitmapy/tarcza.bmp")
Global $jablko = _IrrGetTexture("bitmapy/item1.bmp")
;==> tekstury


_IrrColorKeyTexture($b, 255, 255, 255)
_IrrColorKeyTexture($mob1, 255, 255, 255)
_IrrColorKeyTexture($mob3, 255, 255, 255)
_IrrColorKeyTexture($bonus, 255, 255, 255)
_IrrColorKeyTexture($jablko, 255, 0, 255)
_IrrColorKeyTexture($oslonatex, 255, 255, 255)


menowate()
AdlibRegister("pozycjoner", 100)
AdlibRegister("checkjablko", 100)
AdlibRegister("bonus", 3000)
AdlibRegister("defend", 2000)


WHILE _IrrRunning()
_IrrBeginScene(0, 0, 0)
_IrrDraw2DImageElement($b, $p[0], $p[1], 0, 0, 50, 50, $IRR_USE_ALPHA) ;kulka
mob1()
mob2()
item()

if $bonusodblokuj = 1 Then
_IrrDraw2DImageElement($bonus, $bx, $by, 0, 0, 50, 50, $IRR_USE_ALPHA)
EndIf

if $oslonaodblokuj = 1 Then
_IrrDraw2DImageElement($oslonatex, $ox, $oy, 0, 0, 50, 50, $IRR_USE_ALPHA)
EndIf

_IrrEndScene()
granicamapy()
sterowanie()

WEnd

EndFunc ;==>glowny


func prawo()
$p[0] += $wspolczynniklvlpostac
EndFunc ;==>prawo
func lewo()
$p[0] -= $wspolczynniklvlpostac
EndFunc ;==>lewo

func gora()
$p[1] -= $wspolczynniklvlpostac
EndFunc ;==>gora
func dol()
$p[1] += $wspolczynniklvlpostac
EndFunc ;==>dol


func sterowanie()
if _IsPressed("27") = 1 Then $p[0] += $wspolczynniklvlpostac
if _IsPressed("25") = 1 Then $p[0] -= $wspolczynniklvlpostac
if _IsPressed("28") = 1 Then $p[1] += $wspolczynniklvlpostac
if _IsPressed("26") = 1 Then $p[1] -= $wspolczynniklvlpostac
EndFunc ;==>sterowanie



func granicamapy() ;granica mapy

if $p[0] > 750 Then
$p[0] -= 5
EndIf

if $p[0] < 0 Then
$p[0] += 5
EndIf

if $p[1] < 0 Then
$p[1] += 5
EndIf
if $p[1] > 600 Then
$p[1] -= 5
EndIf
EndFunc ;==>granicamapy


func test()
MsgBox(0, '', $jx & @CRLF & $jy)
EndFunc ;==>test


func mob1()
_IrrDraw2DImageElement($mob1, $mob[0], $mob[1], 0, 0, 50, 50, $IRR_USE_ALPHA)

if $mob[0] < $p[0] then $mob[0] += $wspolczynniklvl
if $mob[1] < $p[1] then $mob[1] += $wspolczynniklvl
if $mob[1] > $p[1] then $mob[1] -= $wspolczynniklvl
if $mob[0] > $p[0] then $mob[0] -= $wspolczynniklvl
if $immortal = 0 then
if($p[0] + 50 > $mob[0]) And($p[1] + 50 > $mob[1]) And($p[0] < $mob[0] + 50) And($p[1] < $mob[1] + 50) Then
gameover()
EndIf
EndIf

EndFunc ;==>mob1


func mob2()
_IrrDraw2DImageElement($mob3, $mob2[0], $mob2[1], 0, 0, 50, 50, $IRR_USE_ALPHA)

if $mob2[0] < $p[0] then $mob2[0] += $wspolczynniklvl
if $mob2[1] < $p[1] then $mob2[1] += $wspolczynniklvl
if $mob2[1] > $p[1] then $mob2[1] -= $wspolczynniklvl
if $mob2[0] > $p[0] then $mob2[0] -= $wspolczynniklvl

if($mob[0] + 50 > $mob2[0]) And($mob[1] + 50 > $mob2[1]) And($mob[0] < $mob2[0] + 50) And($mob[1] < $mob2[1] + 50) Then
if $mob2[0] < $mob[0] then $mob2[0] -= 1
if $mob2[0] > $mob[0] then $mob2[0] += 1
if $mob2[1] < $mob[1] then $mob2[1] -= 1
if $mob2[1] > $mob[1] then $mob2[1] += 1
EndIf

if $immortal = 0 Then
if($p[0] + 50 > $mob2[0]) And($p[1] + 50 > $mob2[1]) And($p[0] < $mob2[0] + 50) And($p[1] < $mob2[1] + 50) Then
gameover()
EndIf
EndIf

EndFunc ;==>mob2

func menowate()
$poz = WinGetPos('XanthousMan')
$x = $poz[0] + $poz[2]
$y = $poz[1]
$Form1 = GUICreate(" ", 150, 275, $x, $y, $WS_POPUP + $WS_THICKFRAME)
GUICtrlCreatePic("bitmapy/tlotray.bmp", 0, 0, 150, 275)
WinMove(" ", "", $x + 5, $y)
$Label1 = GUICtrlCreateLabel("Punkty: ", 6, 69, 83, 17)
_BKColor(-1, -1)
GUICtrlSetColor(-1, 0xff0000)
GUICtrlSetFont(-1, 12)
$Label2 = GUICtrlCreateLabel("Poziom: ", 6, 96, 84, 17)
_BKColor(-1, -1)
GUICtrlSetFont(-1, 12)
GUICtrlSetColor(-1, 0xff0000)
Global $Label3 = GUICtrlCreateLabel($punkty, 75, 69, 76, 17)
_BKColor(-1, -1)
GUICtrlSetFont(-1, 12)
GUICtrlSetColor(-1, 0xcd0)
Global $Label4 = GUICtrlCreateLabel($poziom, 75, 97, 76, 17)
_BKColor(-1, -1)
GUICtrlSetFont(-1, 12)
GUICtrlSetColor(-1, 0xcd0)
GUICtrlSetFont(-1, default, 800)
GUICtrlSetFont(-1, 12)

GUISetState(@SW_SHOW)

EndFunc ;==>menowate

func pozycjoner()
$poz = WinGetPos('XanthousMan')
$x = $poz[0] + $poz[2]
$y = $poz[1]
WinMove(" ", "", $x + 5, $y)
EndFunc ;==>pozycjoner


func item()
if $item = 0 Then
Global $jx = Random(0, 750, 1)
Global $jy = Random(0, 600, 1)
EndIf
_IrrDraw2DImageElement($jablko, $jx, $jy, 0, 0, 50, 50, $IRR_USE_ALPHA)
$item = 1
EndFunc ;==>item





func checkjablko()
if($p[0] + 50 > $jx) And($p[1] + 50 > $jy) And($p[0] < $jx + 50) And($p[1] < $jy + 50) Then

if $p[0] > $jx Then
$item = 0
$punkty += Random(0, 150, 1)
EndIf
if $p[0] < $jx Then
$item = 0
$punkty += Random(0, 150, 1)
EndIf
if $p[1] < $jy Then
$item = 0
$punkty += Random(0, 150, 1)
EndIf
if $p[1] > $jy Then
$item = 0
$punkty += Random(0, 150, 1)
EndIf
SoundPlay($gfx5)
item()
przeleveluj()
EndIf
EndFunc ;==>checkjablko


func przeleveluj()

if $punkty >= 1000 then
$poziom += 1
GUICtrlSetData($Label4, $poziom)
$punkty = 0
SoundPlay($gfx6)
$dodatek += 0.5
$wspolczynniklvl += 0.1
EndIf

GUICtrlSetData($Label3, $punkty)



EndFunc ;==>przeleveluj

func bonus()
if $tarcza = 0 Then
if Random(0, 4, 1) = 2 Then
Global $bx = Random(50, 750, 1)
Global $by = Random(50, 650, 1)
$bonusodblokuj = 1
$tarcza = 1
AdlibRegister("checkbonus", 100)
EndIf
EndIf
EndFunc ;==>bonus



func checkbonus()
AdlibRegister("odliczbonus", 5000)
if($p[0] + 50 > $bx) And($p[1] + 50 > $by) And($p[0] < $bx + 50) And($p[1] < $by + 50) Then

if $p[0] > $bx Then
$tarcza = 0
$bonusodblokuj = 0
EndIf
if $p[0] < $bx Then
$tarcza = 0
$bonusodblokuj = 0
EndIf
if $p[1] < $by Then
$tarcza = 0
$bonusodblokuj = 0
EndIf
if $p[1] > $by Then
$tarcza = 0
$bonusodblokuj = 0
EndIf
$punkty += Random(500, 3000, 1)
SoundPlay($gfx1)
przeleveluj()
AdlibUnRegister("checkbonus")
EndIf
EndFunc ;==>checkbonus

func odliczbonus()
$bonusodblokuj = 0
$tarcza = 0
$bx = -100
$by = -100
AdlibUnRegister("odliczbonus")
EndFunc ;==>odliczbonus


Func _BKColor($BackColor_ = "", $GuiID_ = -1, $Textcolor_ = 0x000000)
If $BackColor_ = "" or $BackColor_ = -1 Then
GUICtrlSetBkColor($GuiID_, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor($GuiID_, $Textcolor_)
Else
GUICtrlSetBkColor($GuiID_, $BackColor_)
GUICtrlSetColor($GuiID_, $Textcolor_)
EndIf
EndFunc ;==>_BKColor




func gameover()
SoundPlay($gfx2)
$z = @CRLF
MsgBox(0, '', 'Przegrałeś!' & $z & 'Twój lvl to: ' & $poziom & $z & "Punktow: " & ($poziom * 1000) + $punkty)
_irrstop()
EndFunc ;==>gameover



func menu()

$Form1 = GUICreate("Xanthous Man", 460, 180, Default, Default, Default)
$Button2 = GUICtrlCreateButton("Wyjscie", 148, 86, 139, 39, $WS_GROUP)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x800000)
$Button1 = GUICtrlCreateButton("Start", 148, 40, 139, 39, $WS_GROUP)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x008000)
GUISetState(@SW_SHOW)
$logo = GUICtrlCreatePic("bitmapy\logo.jpg", 0, 0, 460, 180)
#EndRegion ### END Koda GUI section ###

While 1

$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
case $Button2
Exit
case $Button1
GUIDelete()
glowny()
EndSwitch
WEnd
EndFunc ;==>menu


func defend()
if $oslona = 0 Then
if Random(0, 10, 1) = 4 Then
Global $ox = Random(50, 750, 1)
Global $oy = Random(50, 650, 1)
$oslonaodblokuj = 1
$oslona = 1
AdlibRegister("checkoslona", 100)
EndIf
EndIf
EndFunc ;==>defend



func checkoslona()
if($p[0] + 50 > $ox) And($p[1] + 50 > $oy) And($p[0] < $ox + 50) And($p[1] < $oy + 50) Then

if $p[0] > $ox Then
$oslona = 0
$oslonaodblokuj = 0
EndIf
if $p[0] < $ox Then
$oslona = 0
$oslonaodblokuj = 0
EndIf
if $p[1] < $oy Then
$oslona = 0
$oslonaodblokuj = 0
EndIf
if $p[1] > $oy Then
$oslona = 0
$oslonaodblokuj = 0
EndIf
$immortal = 1
AdlibRegister("odlicz", 5000)
SoundPlay($gfx7)
AdlibUnRegister("checkoslona")
EndIf
EndFunc ;==>checkoslona

func odlicz()
SoundPlay($gfx8)
$immortal = 0
AdlibUnRegister("odlicz")
EndFunc ;==>odlicz


 

 

A oto paczka z grafiką, kodem, Irrlichtem,exekiem i dźwiękami (jakieś 2MB nie całe):

[codehttp://www.uploading.to/jh03grrwqhu7 [/code]

Skan:
https://www.virustotal.com/file/69770d41619f0e885553543f15b3277173f9b1c90a4fbd6aa70aa13c0ff38512/analysis/1332546212/

 

Zbieramy jabłka , uważamy szczególnie na czarnego gościa (na wyższych levelach przyspiesza ostro jesli jest przy mniejszym), tarcza daje nam niesmiertelnosc przez 5 sekund - sygnalizowany koniec i poczatek dzwiekami elektrycznosci.

 

Niektórym podobno nie działa Irrlicht więc jak nie zadziała gra z kodu uruchomiona to przykro mi :P

Oceniajcie i mówcie o ewentualnych błędach , dodatkach itp. :)

Opublikowano

Zacne, zacne... lecz tak:

1. Sterowanie do poprawy... jest totalnie mozolne

2. Bonusy niech się na pewien czas pojawiają.

3. grafika ogólnie do poprawy (tak wiem jak wyglądała poprzednia wersja, lecz możesz napisać na pw to Ci pomogę w miarę wolnego czasu z nową)

9obpmnjr.png

Weteran
Opublikowano

Hehe, fajne tylko ruszanie się trochę psuje rozgrywkę.

Nie wiem czy tylko jak tak mam, ale jak włączę jakieś okno, które zasłoni pierwsze gui, to

przyciski znikają.

1329036830-U154499.png
Opublikowano

Wieczorem zobacze i poprawie sterowanie zeby sie nie zatrzymywal Xanthous na zakretach , wydaje mi sie ze ispressed pomoze ;)

Poprawione sterowanie + znikający bonus :)

Grafiką zajmę się jutro ;P Zkumeku się zadeklarował ,więc czemu nie ;)

 

@UP u mnie nic nie znika :P

Opublikowano

Estetyka? Protecto nie bądź takim pedantem :)

Pisze tak zeby w kodzie się łatwo odnaleźć stąd czasem te przerwy ogromne między funkcjami czy zmiennymi . Kod ma działać nie wyglądać , ale zaraz zrobie w Tidy i wkleje tutaj :P

 

@DOWN: dzięki :D

Opublikowano

skorzystaj z rysowania z użyciem alpha, i jak narysowałeś tego zjeba w gimpie, uzyj tego rozszerzenia(oczywiście dodaj przezroczystość

wtedy użyj _IrrGetCollisionGroupFromMesh($mesh modela)

i jeżeli wynik z tej funkcji jest taki sam jak $scenenode

oczywiście musiałbyś zrobić mesh modela, którego sam nie umiem, dlatego z example mam mesh

tutaj masz przykład robienia ręcznie meshu, ja dodałem kolizje abyś zczaił, plik wrzuć do example albo tam gdzie masz media, bin i biblie i usuń ../ gdzie amsz include itd.

 

 

 

; ----------------------------------------------------------------------------

; Irrlicht Wrapper for Imperative Languages - Freebasic Examples

; Frank Dodd (2006)

; Converted/modified for the au3Irr2 project by linus

; ----------------------------------------------------------------------------

; Example 15 : Custom Mesh

; This example creates a pyramid mesh that is set up ready to be textured

; it then adds the mesh to a new node and applies a material to it

; ----------------------------------------------------------------------------

 

; ////////////////////////////////////////////////////////////////////////////

; Includes for extension libraries

#include "../au3Irrlicht2.au3"

opt("MustDeclareVars", True)

HotKeySet("{ESC}", "_exit")

 

Func _exit()

_IrrStop()

Exit

EndFunc ; _exit

 

; ////////////////////////////////////////////////////////////////////////////

; global variables

 

; irrlicht objects

DIM $hMesh ; irr_mesh

DIM $MeshTexture ; irr_texture

DIM $SceneNode ; irr_node

DIM $OurCamera ; irr_camera

DIM $CameraNode

DIM $SelectorGround

DIM $CombinedCollision

DIM $CollisionAnimator

 

 

; ////////////////////////////////////////////////////////////////////////////

 

 

; -----------------------------------------------------------------------------

; start the irrlicht interface with defaults

_IrrStart()

 

; set the window caption

_IrrSetWindowCaption( "Example 15: Create a custom mesh" )

 

; a mesh is created from an array of types called vertices that define a point

; in space. and an array of indices to these vertices that are grouped into

; threes to create triangles that form the mesh

local $tVertex = __CreateVertStruct(5) ; $IRR_VERT

 

; set up five vertices to define the points of a pyramid. the vertices have

; many properties that need to be set up to properly define the structure

__SetVertStruct($tVertex, 0, $VERT_X, -20)

__SetVertStruct($tVertex, 0, $VERT_Y, 0)

__SetVertStruct($tVertex, 0, $VERT_Z, -20)

__SetVertStruct($tVertex, 1, $VERT_X, -20)

__SetVertStruct($tVertex, 1, $VERT_Y, 0)

__SetVertStruct($tVertex, 1, $VERT_Z, 20)

__SetVertStruct($tVertex, 2, $VERT_X, 20)

__SetVertStruct($tVertex, 2, $VERT_Y, 0)

__SetVertStruct($tVertex, 2, $VERT_Z, 20)

__SetVertStruct($tVertex, 3, $VERT_X, 20)

__SetVertStruct($tVertex, 3, $VERT_Y, 0)

__SetVertStruct($tVertex, 3, $VERT_Z, -20)

__SetVertStruct($tVertex, 4, $VERT_X, 0)

__SetVertStruct($tVertex, 4, $VERT_Y, 35)

__SetVertStruct($tVertex, 4, $VERT_Z, 0)

 

; the co-ordinates across a texture run from 0 to 1 so we place each of the

; vertices on this texture plane to appear ; if the pyramid was painted from

; its bottom up

__SetVertStruct($tVertex, 0, $VERT_TEXTUREX, 0)

__SetVertStruct($tVertex, 0, $VERT_TEXTUREY, 0)

__SetVertStruct($tVertex, 1, $VERT_TEXTUREX, 0)

__SetVertStruct($tVertex, 1, $VERT_TEXTUREY, 1)

__SetVertStruct($tVertex, 2, $VERT_TEXTUREX, 1)

__SetVertStruct($tVertex, 2, $VERT_TEXTUREY, 1)

__SetVertStruct($tVertex, 3, $VERT_TEXTUREX, 1)

__SetVertStruct($tVertex, 3, $VERT_TEXTUREY, 0)

__SetVertStruct($tVertex, 4, $VERT_TEXTUREX, 0.5)

__SetVertStruct($tVertex, 4, $VERT_TEXTUREY, 0.5)

 

; each of the vertices can be assigned a colour to tint the texture, in this

; case we use white

 

__SetVertStruct($tVertex, 0, $VERT_VCOLOR, _IrrMakeARGB(0, 255, 255, 255))

__SetVertStruct($tVertex, 1, $VERT_VCOLOR, _IrrMakeARGB(0, 255, 255, 255))

__SetVertStruct($tVertex, 2, $VERT_VCOLOR, _IrrMakeARGB(0, 255, 255, 255))

__SetVertStruct($tVertex, 3, $VERT_VCOLOR, _IrrMakeARGB(0, 255, 255, 255))

__SetVertStruct($tVertex, 4, $VERT_VCOLOR, _IrrMakeARGB(0, 255, 255, 255))

 

; -----------------------------------------------------------------------------

; create the faces, this is an array of indices referencing the vectors they

; are collected into groups of three each defining a triangle in the mesh

local $aIndices[18] = [0,1,4, 1,2,4, 2,3,4, 3,0,4, 2,1,0, 0,3,2]

 

; create the mesh from the array of vertices and indices

$hMesh = _IrrCreateMesh("testMesh", $tVertex, $aIndices)

 

; load texture resource for texturing the nodes

$MeshTexture = _IrrGetTexture( "../media/au3irr2_logo.jpg" )

 

; add the mesh to the scene

$SceneNode = _IrrAddMeshToScene( $hMesh )

_IrrAddRotationAnimator($SceneNode, 0, 0.2, 0)

 

; apply a material to the node

_IrrSetNodeMaterialTexture( $SceneNode, $MeshTexture, 0 )

 

; switch off lighting effects on this node

_IrrSetNodeMaterialFlag( $SceneNode, $IRR_EMF_LIGHTING, $IRR_OFF )

 

 

; add a camera into the scene and resposition it to look at the pyramid

$OurCamera = _IrrAddFPSCamera()

_IrrSetNodePosition( $OurCamera, 30,50,25)

_IrrSetCameraTarget($OurCamera, 0,0,0)

 

 

$SelectorGround = _IrrGetCollisionGroupFromBox( $SceneNode )

 

; now that we have collision objects for each of the nodes we need to combine

; them into a collision group

$CombinedCollision = _IrrCreateCombinedCollisionGroup ()

 

; creates a meta-selector that is a group of selector objects

_IrrAddCollisionGroupToCombination ( $CombinedCollision, $SelectorGround )

 

; finally we add a collision animator to the camera, this constrains the camera

; so that its movement is restricted by collision with the collision groups we

; just created. the parameters we supply are ; follows: -

; The collision objects, the node to be effected by collision,

; x, y and z radius of the collision area,

; x, y and z force of gravity to apply to the node affected by collision,

; x, y and z offset of the node

$CollisionAnimator = _IrrAddCollisionAnimator( _

$CombinedCollision, $OurCamera, _

1.0,5.0,6.0, _

0.0,0.0,0.0, _

0.0,0,0.0 )

_IrrHideMouse()

 

 

; -----------------------------------------------------------------------------

; while the irrlicht environment is still running

WHILE _IrrRunning()

; begin the scene, erasing the canvas with sky-blue before rendering

_IrrBeginScene( 0, 0, 50 )

 

; draw the scene

_IrrDrawScene()

 

; end drawing the scene and render it

_IrrEndScene()

WEND

 

; -----------------------------------------------------------------------------

; Stop the irrlicht engine and release resources

_IrrStop()

 

 

$MD2Mesh = _IrrGetMesh("media/zumlin.md2")

$SceneNode = _IrrAddMeshToScene($MD2Mesh)

 

ja mam np.

 

$aStartVector = _IrrGetNodePosition($Camera)
$aEndVector = _IrrGetCameraTarget($Camera)
While _IrrMouseEventAvailable()
$pKeyEvent = _IrrReadMouseEvent()
$mouseX = __getMouseEvt($pKeyEvent, $EVT_MOUSE_IX)
$mouseY = __getMouseEvt($pKeyEvent, $EVT_MOUSE_IY)
		$SelectedNode = _IrrGetCollisionNodeFromScreenCoordinates($mouseX, $mouseY)
if $SelectedNode = $SceneNode Then $SelectedNode = _IrrGetNodeName($SelectedNode)
; check for mousewheel event, report up or down movement inside this window title:
If __getMouseEvt($pKeyEvent, $EVT_MOUSE_IACTION) = $IRR_EMIE_LMOUSE_PRESSED_DOWN Then
If $atk = 1 Then
$atkk = 5

EndIf
EndIf
WEnd

aby sprawdzić czy myszka(środek kursora) jest na danym modelu

  • 1 miesiąc temu...
  • 6 miesięcy temu...
Opublikowano

Skoro to irrlicht to pewnie nie masz Directxa SDK

 

@DOWN: fakt nie spojrzalem na date posta wyzej :P

Ktoś dał like'a to wchodzę i odpisuje xD

PS: co do gry to jest totalny chłam :P W c++ lepiej się pisze , ale to były początki programowania no i irrlicht wpadł w łapy to chciałęm coś skleić :)

ALE najważniejsze ,że kod w miarę zorganizowany i czytelny ;)

 

 

Wybaczcie Panowie za lekki spam.

Kod został skradziony z MPC do : cstux'a , więc to jest tylko post dla potwierdzenia tego,że jestem jego autorem...

Opublikowano

@wojtek333... oj wojtku :P ale z ciebie kopacz :D chociaż to ja w dziale WarRock ostatnio temat z 2009 wykopałem xD

 

 

A co do gry, żeby nie uznać tego za spam to gierka fajna i wgl, ale kilka rzeczy bym poprawił i najważniejsze co mnie zawsze kusi to pisać w C++, ale za starania i fajny kodzik z którym będę mógł się pobawić masz LIKE IT ;)

"Jesteśmy ludźmi, bo popełniamy błędy i na nich się uczymy."

  • 1 miesiąc temu...
Opublikowano

Download nie działa, a chce to sprawdzić. Podeślijcie ktoś tą paczkę, albo zróbcie reupload. Plz

Opublikowano

Ja też bym prosił o re-upload

Law of Revelation: The hidden flaw never remains hidden.

  • 3 lata później...

Zarchiwizowany

Ten temat przebywa obecnie w archiwum. Dodawanie nowych odpowiedzi zostało zablokowane.

×
×
  • Dodaj nową pozycję...