Zweites MD2 Modell in den Code einfügen?

Übersicht BlitzBasic Blitz3D

Neue Antwort erstellen

 

lukasimgruet

Betreff: Zweites MD2 Modell in den Code einfügen?

BeitragSo, Jan 24, 2010 11:57
Antworten mit Zitat
Benutzer-Profile anzeigen
Ich wollte gestern ein zweites MD2 Modell einfügen. Doch als ich das versuchte, wurde das Modell riesig über das ganze Spiel und transparent eingefügt.
Code: [AUSKLAPPEN]


Graphics3D 1024,768,32,1
Include "start.bb"
Include "keyconstants.bb"

musik = LoadSound("track2.mp3")
LoopSound musik
PlaySound(musik)

SetBuffer BackBuffer()

banner = LoadImage("top-banner.jpg")
MaskImage banner,255,255,0
Message=1

; Variables
Dim pillar(7)
Global grunt
Global dragon
Global Character_pivot
Global PLAYER = 1
Global OBSTACLE = 2
Global TRIGGER = 3
Global door
Global door_state = 1
entity# = 0
Global door_moving = False
Global SoundID = LoadSound ("heart.wav")
Global ChannelID


sound = PlaySound ("track.mp3")
LoopSound sound

; Grunt
; Load Grunt & Weapon
   grunt_tex = LoadTexture("armour.pcx",1)
   character_pivot = CreatePivot()
   grunt = LoadMD2("tris.md2",character_pivot)
   EntityTexture grunt,grunt_tex
   ScaleEntity grunt,0.015,0.015,0.015
   PositionEntity character_pivot,0,2,-1
   EntityType character_pivot,PLAYER,1
   EntityRadius grunt,0.1
   EntityRadius character_pivot,0.4

dragon_tex = LoadTexture("dragon.bmp",1)
   character_pivot = CreatePivot()
   dragon = LoadMD2("dragon.md2",character_pivot)
   EntityTexture dragon,dragon_tex
   ScaleEntity grunt,0.015,0.015,0.015
   PositionEntity character_pivot,0,2,-1
   EntityType character_pivot,PLAYER,1
   EntityRadius dragon,0.1
   EntityRadius character_pivot,0.4


; Scenery
   ; Create Ground Floor
groundfloor = CreateCube()
groundfloor_tex = LoadTexture("marble.jpg")
ScaleEntity groundfloor,2,0.1,3
PositionEntity groundfloor,0,0,5
EntityTexture groundfloor,groundfloor_tex
ScaleTexture groundfloor_tex,0.3,0.3
EntityType groundfloor,OBSTACLE

groundfloor2 = CreateCube()
groundfloor_tex = LoadTexture("marble.jpg")
ScaleEntity groundfloor2,2,0.1,3
PositionEntity groundfloor2,0,0,-1
EntityTexture groundfloor2,groundfloor_tex
ScaleTexture groundfloor_tex,0.3,0.3
EntityType groundfloor2,OBSTACLE

groundfloor3 = CreateCube()
groundfloor_tex = LoadTexture("marble.jpg")
ScaleEntity groundfloor3,2,0.1,3
PositionEntity groundfloor3,0,0,11
EntityTexture groundfloor3,groundfloor_tex
ScaleTexture groundfloor_tex,0.3,0.3
EntityType groundfloor3,OBSTACLE


groundfloor4 = CreateCube()
groundfloor_tex = LoadTexture("marble.jpg")
ScaleEntity groundfloor4,2,0.1,3
PositionEntity groundfloor4,0,0,17
EntityTexture groundfloor4,groundfloor_tex
ScaleTexture groundfloor_tex,0.3,0.3
EntityType groundfloor4,OBSTACLE

groundfloor5 = CreateCube()
groundfloor_tex = LoadTexture("marble.jpg")
ScaleEntity groundfloor5,4,0.2,6
PositionEntity groundfloor5,0,0,23
EntityTexture groundfloor5,groundfloor_tex
ScaleTexture groundfloor_tex,0.3,0.3
EntityType groundfloor5,OBSTACLE

   ; Create Plane
plane = CreatePlane()
plane_tex = LoadTexture("plane.jpg")
EntityTexture plane,plane_tex
EntityAlpha plane,0.4
EntityType plane,OBSTACLE

   ;Mirror


   ; Create Walls
wall1 = CreateCube()
wall_tex = LoadTexture("wall.jpg")
ScaleEntity wall1,0.1,1,6
PositionEntity wall1,2,1,2
EntityTexture wall1,wall_tex
ScaleTexture wall_tex,0.3,1
EntityType wall1,OBSTACLE

wall2 = CopyEntity(wall1)
PositionEntity wall2,-2,1,2
EntityType wall2,OBSTACLE

   ;wall3 = CopyEntity(wall1)
   ;PositionEntity wall3,0,1,8
   ;ScaleEntity wall3,0.1,1,2
   ;TurnEntity wall3,0,90,0
   ;EntityType wall3,OBSTACLE

wall4 = CopyEntity(wall1)
PositionEntity wall4,0,1,-4
ScaleEntity wall4,0.1,1,2
TurnEntity wall4,0,90,0
EntityType wall4,OBSTACLE


wall6 = CopyEntity(wall1)
PositionEntity wall6,-2,1,10
EntityType wall6,OBSTACLE

wall7 = CopyEntity(wall1)
PositionEntity wall7,2,1,10
EntityType wall7,OBSTACLE

wall8 = CopyEntity(wall1)
PositionEntity wall8,-3,1,17
ScaleEntity wall8,1,1,2
TurnEntity wall8,0,90,0
EntityType wall8,OBSTACLE

wall9 = CopyEntity(wall1)
PositionEntity wall9,3,1,17
ScaleEntity wall9,1,1,2
TurnEntity wall9,0,90,0
EntityType wall9,OBSTACLE

wall10 = CopyEntity(wall1)
PositionEntity wall10,-2,1,29
ScaleEntity wall10,0.1,1,2
TurnEntity wall10,0,90,0
EntityType wall10,OBSTACLE

wall11 = CopyEntity(wall1)
PositionEntity wall11,2,1,29
ScaleEntity wall11,0.1,1,2
TurnEntity wall11,0,90,0
EntityType wall11,OBSTACLE

treppe1 = CopyEntity(wall1)
PositionEntity treppe1,-1,0.3,25
ScaleEntity treppe1,0.1,0.2,0.3
TurnEntity treppe1,0,90,0
EntityType treppe1,OBSTACLE

treppe2 = CopyEntity(wall1)
PositionEntity treppe2,-1,0.2,24.8
ScaleEntity treppe2,0.1,0.1,0.3
TurnEntity treppe2,0,90,0
EntityType treppe2,OBSTACLE

treppe3 = CopyEntity(wall1)
PositionEntity treppe3,-1,0.4,25.2
ScaleEntity treppe3,0.1,0.3,0.3
TurnEntity treppe3,0,90,0
EntityType treppe3,OBSTACLE

treppe4 = CopyEntity(wall1)
PositionEntity treppe4,-1,0.5,25.4
ScaleEntity treppe4,0.1,0.4,0.3
TurnEntity treppe4,0,90,0
EntityType treppe4,OBSTACLE

treppe5 = CopyEntity(wall1)
PositionEntity treppe5,-1,0.6,25.6
ScaleEntity treppe5,0.1,0.5,0.3
TurnEntity treppe5,0,90,0
EntityType treppe5,OBSTACLE

treppe6 = CopyEntity(wall1)
PositionEntity treppe6,-1,0.7,25.8
ScaleEntity treppe6,0.1,0.6,0.3
TurnEntity treppe6,0,90,0
EntityType treppe6,OBSTACLE

treppe7 = CopyEntity(wall1)
PositionEntity treppe7,-1,0.8,26
ScaleEntity treppe7,0.1,0.7,0.3
TurnEntity treppe7,0,90,0
EntityType treppe7,OBSTACLE

treppe8 = CopyEntity(wall1)
PositionEntity treppe8,-1,0.9,26.2
ScaleEntity treppe8,0.1,0.8,0.3
TurnEntity treppe8,0,90,0
EntityType treppe8,OBSTACLE

treppe9 = CopyEntity(wall1)
PositionEntity treppe9,-1,1.0,26.4
ScaleEntity treppe9,0.1,0.9,0.3
TurnEntity treppe9,0,90,0
EntityType treppe9,OBSTACLE

treppe10 = CopyEntity(wall1)
PositionEntity treppe10,-1,1.1,26.6
ScaleEntity treppe10,0.1,1.0,0.3
TurnEntity treppe10,0,90,0
EntityType treppe10,OBSTACLE

groundfloor6 = CreateCube()
groundfloor_tex = LoadTexture("marble.jpg")
ScaleEntity groundfloor6,4.0,0.1,1.2
PositionEntity groundfloor6,0,2.0,27.9
EntityTexture groundfloor6,groundfloor_tex
ScaleTexture groundfloor_tex,0.3,0.3
EntityType groundfloor6,OBSTACLE












door = CopyEntity(wall1)
door_tex = LoadTexture("door.jpg")
PositionEntity door,0,1,16
ScaleEntity door,0.1,1,1
TurnEntity door,0,90,0
EntityTexture door,door_tex
EntityType door,OBSTACLE
EntityPickMode door,1

; Create Camera
camera = CreateCamera(grunt)
PositionEntity camera,1,300,-750
TurnEntity camera,20,1,0
CameraZoom camera,2
CameraRange camera,1,4000


; Handle Collisions
Collisions PLAYER,OBSTACLE,2,2
Collisions OBSTACLE,PLAYER,1,1

; Light
AmbientLight 2000,2000,2000
light = CreateLight(1)
TurnEntity light,0,0,90
PositionEntity light,0,1,10

; Main Loop
While Not KeyHit(1)
   
   movegrunt()
   checkgravity()
   triggerdoor()
   
   x=MouseX()
   y=MouseY()
   
   e=CameraPick(camera,x,y)
   If e<>entity#
      If entity Then EntityColor entity,255,255,255
      entity#=e
   EndIf
   
   If MouseHit(1) And entity#=e
      door_moving=True
      triggerdoor()
   End If
   
   If entity#
      EntityColor entity,255,0,0
   EndIf
   
   UpdateWorld
   RenderWorld
       
DrawImage banner,0,0
   
   If KeyHit(17) Then
      WireMode = Not WireMode
      WireFrame WireMode
   End If
   
   Rect x,y-3,1,7   
   Rect x-3,y,7,1
   
   Flip
   
Wend
End


; Functions
Function triggerdoor()
   If door_state = 1 And door_moving = True Then
      MoveEntity door,0,.1,0
      If EntityY(door) > 2 Then door_state = 0: door_moving = False: EntityAlpha door,0.3
   Else If door_state = 0 And door_moving = True Then
      MoveEntity door,0,-.1,0 door_moving = True
      If EntityY(door) < 1 Then door_state = 1: door_moving = False: EntityAlpha door,1
   End If
End Function

Function checkgravity()
   If Not EntityCollided(Character_pivot,OBSTACLE)
      TranslateEntity Character_pivot,0,-0.05,0
    End If
End Function

Function movegrunt()
   
   If KeyDown(key_arrowpad_left)
      TurnEntity Character_pivot,0,3,0
   End If
   
   If KeyDown(key_arrowpad_right)
      TurnEntity Character_pivot,0,-3,0
   End If
   
   If KeyDown(key_arrowpad_up)
      MoveEntity Character_pivot,0,0,0.035
      moved = 1
      forward = 1
      If Not ChannelPlaying (ChannelID) Then
         ChannelID = PlaySound (SoundID)
      EndIf
   End If
   
   If KeyDown(key_arrowpad_down)
      MoveEntity Character_pivot,0,0,-0.035
      moved = 1
      forward = 0
   If Not ChannelPlaying (ChannelID) Then
         ChannelID = PlaySound (SoundID)
      EndIf
End If
   
   If moved = True
      If forward = True   
         If MD2AnimTime(grunt) < 40 Or MD2AnimTime(grunt) > 46 Then
            AnimateMD2 grunt,1,0.1,40,46
         End If
      End If
   End If
   
   If forward = False
      If MD2AnimTime(grunt) < 40 Or MD2AnimTime(grunt) > 46 Then
         AnimateMD2 grunt,1,-0.08,40,45
      End If
   End If
   
   If moved = False
      If MD2AnimTime(grunt) < 0 Or MD2AnimTime(grunt) > 10 Then
         AnimateMD2 grunt,1,0.1,0,5
      End If
    End If     
    moved = 0
   forward = 0
End Function
  • Zuletzt bearbeitet von lukasimgruet am Do, Apr 13, 2023 12:29, insgesamt einmal bearbeitet

jokerman29

BeitragSo, Jan 24, 2010 12:40
Antworten mit Zitat
Benutzer-Profile anzeigen
ich bin mir nicht sicher, obs funkzt aber versuchs mal mit BlitzBasic: [AUSKLAPPEN]
ScaleImage

zu verkleinern...
WhY sO sErIoUs? LeT´s PuT a SmIlE oN tHaT fAcE!

Rechtschreibfehler sind special-effekts meiner Tastatur Wink
 

BIG BUG

BeitragSo, Jan 24, 2010 12:43
Antworten mit Zitat
Benutzer-Profile anzeigen
Das Größenproblem kommt daher weil Du beim zweiten ScaleEntity das erste Modell skalierst:
Code: [AUSKLAPPEN]
   ScaleEntity grunt,0.015,0.015,0.015
B3D-Exporter für Cinema4D!(V1.4)
MD2-Exporter für Cinema4D!(final)
 

lukasimgruet

BeitragSo, Jan 24, 2010 12:48
Antworten mit Zitat
Benutzer-Profile anzeigen
ok danke es geht nun endlich wie ichs wollte. doch wie schaffe ich es mein md2 mesh zu animieren ohne das man eine taste drücken muss?

Ich fand nur das in der Hilfe:

Code: [AUSKLAPPEN]

Graphics3D 640, 480
SetBuffer BackBuffer()
camera = CreateCamera()
light = CreateLight()
RotateEntity light, 90, 0, 0
gargoyle = LoadMD2("media/gargoyle/gargoyle.md2")
garg_tex = LoadTexture("media/gargoyle/gargoyle.bmp")
EntityTexture gargoyle, garg_tex
PositionEntity gargoyle, 0, - 45, 100
RotateEntity gargoyle, 0, 180, 0

While Not KeyHit(1)
   If KeyHit(57) = 1 Then
      start = 1 - start
      AnimateMD2 gargoyle, start, 0.1, 32, 46
   EndIf
   UpdateWorld
   RenderWorld
   Text 0, 0, "Mit Leertaste anhalten/fortsetzten"
   Text 0, 20, "MD2Animating: " + MD2Animating(gargoyle)
   Flip
   Wend
End

Nicdel

BeitragSo, Jan 24, 2010 12:58
Antworten mit Zitat
Benutzer-Profile anzeigen
Einfach die Tastenabfrage rausmachen?!
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

Tankbuster

BeitragSo, Jan 24, 2010 12:58
Antworten mit Zitat
Benutzer-Profile anzeigen
Ich rate dir ein paar Grundlegende Tutorials durchzulesen, bevor du an deinem Projekt weitermachst.
Sry, aber es sieht so aus, als ob du nichtmal If und EndIf kennen würdest.
Twitter
Download Jewel Snake!
Windows|Android
 

lukasimgruet

BeitragSo, Jan 24, 2010 13:01
Antworten mit Zitat
Benutzer-Profile anzeigen
Ich habe ja bei den Hilfen geschaut.

Doch ich begreifs immer noch nicht Crying or Very sad
Wenn ich die Tastaturabfrage rausnehme:

If KeyHit(57) = 1 Then
start = 1 - start

dann kommt immer noch ein fehler

BladeRunner

Moderator

BeitragSo, Jan 24, 2010 13:04
Antworten mit Zitat
Benutzer-Profile anzeigen
Du mußt mittels if und einer Variable dafür sorgen dass der animate-befehl exakt einmal aufgerufen wird.

Also: prüfe eine Variable auf ihren Wert, ist er gleich wird animate aufgerufen und die Variable auf einen Wert gesetzt bei der nicht aufgerufen wird.
Zu Diensten, Bürger.
Intel T2300, 2.5GB DDR 533, Mobility Radeon X1600 Win XP Home SP3
Intel T8400, 4GB DDR3, Nvidia GF9700M GTS Win 7/64
B3D BMax MaxGUI

Stolzer Gewinner des BAC#48, #52 & #92

BladeRunner

Moderator

BeitragSo, Jan 24, 2010 13:06
Antworten mit Zitat
Benutzer-Profile anzeigen
Das ist mir glatt mal nen Doppelpost wert: Welcher fehler kommt denn? 'expecting ..."? dann solltest Du das zum If gehörige Endif auch entfernen Wink

EDIT: Und nun müsste ich boshafterweise fragen wer dir bislang den Code geschrieben hat, denn von dir ist er wohl nicht.
EDIT2: ich seh schon, die OnlineHilfe war so nett.
Zu Diensten, Bürger.
Intel T2300, 2.5GB DDR 533, Mobility Radeon X1600 Win XP Home SP3
Intel T8400, 4GB DDR3, Nvidia GF9700M GTS Win 7/64
B3D BMax MaxGUI

Stolzer Gewinner des BAC#48, #52 & #92
 

lukasimgruet

BeitragSo, Jan 24, 2010 13:52
Antworten mit Zitat
Benutzer-Profile anzeigen
es kommt die fehlermeldung endif without if

Nicdel

BeitragSo, Jan 24, 2010 13:54
Antworten mit Zitat
Benutzer-Profile anzeigen
Lesen hilft:
Zitat:
dann solltest Du das zum If gehörige Endif auch entfernen
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
 

lukasimgruet

BeitragSo, Jan 24, 2010 13:58
Antworten mit Zitat
Benutzer-Profile anzeigen
jetzt wird es aber nocht mehr animiert
 

lukasimgruet

BeitragSo, Jan 24, 2010 14:24
Antworten mit Zitat
Benutzer-Profile anzeigen
habs geschafft.
Code: [AUSKLAPPEN]

tex=LoadTexture( "dragon.bmp" )
dragon=LoadMD2( "dragon.md2" )
EntityTexture dragon,tex
PositionEntity dragon,2,1.5,22
TurnEntity dragon,0,150,0
AnimateMD2 dragon,1,.05,0,40
ScaleEntity dragon,0.050,0.050,0.050

Neue Antwort erstellen


Übersicht BlitzBasic Blitz3D

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group