Iso Tiles + Maus
Übersicht

![]() |
Mathias-KwiatkowskiBetreff: Iso Tiles + Maus |
![]() Antworten mit Zitat ![]() |
---|---|---|
hi ,leute ich habe hier den netten code gefunden allerdings versteh ich nicht wie ich da eine mausabfrage einbauen kann, da es "iso" ist ^^
hier eimal der code Code: [AUSKLAPPEN] SuperStrict
Type TTile Global _width:Int = 62 'breite des Tiles Global _height:Int = 32 'höhe des Tiles Field _xPos:Int 'x-position Field _yPos:Int 'y-position Field _hPos:Int 'h-position (höhe) Field _material:Int 'material (frame nummer) 'seter (Ich glaube zu denen muss ich nichts sagen, oder?) Method setXPos( xPos:Int ) _xPos = xPos EndMethod Method setYPos( yPos:Int ) _yPos = yPos EndMethod Method setHPos( hPos:Int ) _hPos = hPos EndMethod Method setMaterial( material:Int ) _material = material EndMethod 'geter (Ich glaube zu denen muss ich auch nichts sagen) Method getXPos:Int() Return _xPos EndMethod Method getYPos:Int() Return _yPos EndMethod Method getHPos:Int() Return _hPos EndMethod Method getMaterial:Int() Return _material EndMethod 'functions / methods Function Create:TTile( xPos:Int,yPos:Int,hPos:Int,material:Int ) Local n:TTile = New TTile 'neues TTile objekt erstellen n.setXPos( xPos ) 'x-position übergeben n.setYPos( yPos ) 'y-position übergeben n.setHPos( hPos ) 'h-position übergeben n.setMaterial( material ) 'material-nummer übergeben Return n 'fertiges TTile zurückgeben EndFunction Method draw() 'diese Methode wird unter dem Code besprochen DrawImage tileset,_xPos * zoom - (scrollX*TTile._width), _yPos * zoom - _hPos - (scrollY*TTile._height),_material EndMethod EndType '--------------------- Graphics 640, 480 SetMaskColor 255, 0, 255 Global map:TTile[600, 600] Global colorMap:TPixmap Global scrollX:Int = 0 Global scrollY:Int = 0 Global screenWidth:Int = GraphicsWidth() / TTile._width 'wie viele Tiles diagonal auf den Bildschim passen Global screenHeight:Int = GraphicsHeight() / TTile._height * 2 'und wie viele horizontal drauf passen Global zoom:Float = 1 Global mainTimer:TTimer = CreateTimer( 60 ) Global tileset:TImage = LoadAnimImage("tilesetz.png", TTile._width, 32, 0, 2) 'Tileset als AnimImage laden Global x:Int, y:Int 'mainloop newMap() 'neue leere Map erstellen map[2, 2].setMaterial(1) 'renderMap() Repeat Cls If KeyDown(KEY_RIGHT) Then scrollX = scrollX + 1 End If If KeyDown(KEY_LEFT) Then scrollX = scrollX - 1 End If If KeyDown(KEY_UP) Then scrollY = scrollY + 1 End If If KeyDown(KEY_DOWN) Then scrollY = scrollY - 1 End If drawMap() 'Map neu Zeichnen If MouseHit( 1 ) Print "x: " + x + " y: " + y EndIf WaitTimer( mainTimer ) 'auf den Timer warten... Flip 0 Until AppTerminate() Or KeyDown( key_escape ) Function newMap() For Local y:Int = 0 To 599 For Local x:Int = 0 To 599 Local xpos:Int = ((x*TTile._width)+(y Mod 2)*(TTile._width/2)) 'x-position berechnen Local ypos:Int = (y*(TTile._height/2 + 1)) 'y-position berechnen map[x, y] = TTile.Create(xpos, ypos, 0, 0) 'neues TTile erstellen mit x,y,h,m parametern Next Next EndFunction Function drawMap() SetScale( zoom,zoom ) 'scale auf zoom setzen For Local y:Int = scrollY To scrollY + screenHeight + 1 For Local x:Int = scrollX To scrollX + screenWidth + 1 map[ x,y ].draw() 'TTile.Draw() Methode des jeweiligen Tiles aufrufen Next Next SetScale( 1,1 ) 'scale auf "normal" setzen (1,1) EndFunction das scrollen funktioniert, aber mausabfrage geht einfach gar nicht.... hab einiges ausprobiert, und auch "gesucht" kann mir jemand sagen wie es richtig funktioniert? |
||
![]() |
Nicdel |
![]() Antworten mit Zitat ![]() |
---|---|---|
https://www.blitzforum.de/foru...hp?t=33499 | ||
Desktop: Intel Pentium 4 2650 Mhz, 2 GB RAM, ATI Radeon HD 3850 512 MB, Windows XP
Notebook: Intel Core i7 720 QM 1.6 Ghz, 4 GB DDR3 RAM, nVidia 230M GT, Windows 7 |
![]() |
Mathias-Kwiatkowski |
![]() Antworten mit Zitat ![]() |
---|---|---|
naja habe schon gemerkt das der gesammte code irgendwie nicht funktioniert., leider
und das mit der mausabfrage is verdammt ungenau, und funktioniert leider nicht |
||
Lion |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Benutz einfach ImageRectCollide oder wie das ding heißt (kA ob das bei Bmax buggt, alternativ einfach die überarbeitete BB version für Bmax umschreiben), ist am einfachsten. | ||
Intel Core 2 Quad 4x2.66 ghz - 4gb ddr2 - nvidia GeForce GTX660 2gb
Intel Atom 1x1.83 ghz - 2gb ddr2 - intel GMA 3150 256mb AMD A10-5750M 4x2.5 ghz - 8 gb ddr4 - AMD R9 M290x |
![]() |
HolzchopfMeisterpacker |
![]() Antworten mit Zitat ![]() |
---|---|---|
Wenn ich das richtig sehe, sollte dir das hier weiterhelfen (einfach nach BMax umschreiben, ist aber kein Problem).
mfG Holzchopf |
||
Erledige alles Schritt um Schritt - erledige alles. - Holzchopf
CC BY ♫ BinaryBorn - Yogurt ♫ (31.10.2018) Im Kopf da knackt's und knistert's sturm - 's ist kein Gedanke, nur ein Wurm |
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group