b3d file + textures
Blitz3D Forums/Blitz3D Programming/b3d file + textures
| ||
hi there i create a large maplet level and textures the level with decorator . no i move my player arround and if the playerhand collide with a level-piece i will get the texturname from this point . any code will helpfull thx |
| ||
Just guessing :) Note: I'm using a linepick down from a player position, you'll have to use collision commands to get a collided surface. ; do line pick down from, player LinePick playerx#,playery#,playerz#,0,-2,0 If PickedSurface() pb=GetSurfaceBrush(PickedSurface()) If pb pt=GetBrushTexture(pb,index) ; index = texture layer, 0 - 7 If pt TexFileName$=TextureName$(pt) FreeTexture pt ; GetBrushTexture() creates a NEW COPY of the texture, so it must be freed End If FreeBrush pb ; GetBrushTexture() creates a NEW COPY of the brush, so it must be freed End If End If |
| ||
how would I make my footstep sound change depending on the texture i am standing on? I undertand how to access a texture, but how to interact with it. |
| ||
; do line pick down from, player LinePick playerx#,playery#,playerz#,0,-2,0 If PickedSurface() pb=GetSurfaceBrush(PickedSurface()) If pb pt=GetBrushTexture(pb,index) ; index = texture layer, 0 - 7 If pt TexFileName$=StripPath$(TextureName$(pt)) Select TexFileName$ Case "metal.png" If footdown Then PlaySound metalstep Case "wood.jpg" If footdown Then PlaySound woodstep End Select FreeTexture pt ; GetBrushTexture() creates a NEW COPY of the texture, so it must be freed End If FreeBrush pb ; GetBrushTexture() creates a NEW COPY of the brush, so it must be freed End If End If Function StripPath$(file$) If Len(file$)>0 For i=Len(file$) To 1 Step -1 mi$=Mid$(file$,i,1) If mi$="\" Or mi$="/" Then Return name$ Else name$=mi$+name$ Next EndIf Return name$ End Function |
| ||
woah cool man. thanks. i always fancied doing that in my game. i cam make a 'dog poo' texture and have the foot make a squish sound |
| ||
ah i understand . thanks . |
| ||
hi. sorry for pushing up this ooold thread - but it fits perfect to here (i think). with the func above i can get the name of the texture on a surface... well, good. how can i apply a new texture to this surface. i think with entitytexture i'll texture the whole entity with the new one, but that isn't what i mean. (i'm not sure, since i'm on work and have no blitz here...). hope there is a solution :) EDIT: PaintSurface - Stupid me.... |