jump´n run kampf
Übersicht

demonboyBetreff: jump´n run kampf |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
so ich brauch noch ma eure hilf aber ich war mir nicht ganz sicher ob das hier her oder eher in die kategorie blitz 2D gehört...
also ich möcht gerne wissen wie ich in folgendem scrit dafür sorgen kann, dass das schwert (wl oder wr) zunächst mal seine komplette animation SICHTBAR anzeigt.und das sie danach wieder gelöscht wird... Code: [AUSKLAPPEN] AppTitle "Armys of Glory" Graphics 640,480 SetBuffer BackBuffer() frametimer = CreateTimer (30) ClsColor 0, 0, 0 ;Graphics Global tile = LoadImage ("tile.bmp") MaskImage tile, 255, 0, 255 Global tile2 = LoadImage ("tile2.bmp") MaskImage tile2, 255, 0, 255 Global tile3 = LoadImage ("tile3.bmp") MaskImage tile3, 255, 0, 255 Global tile4 = LoadImage ("tile4.bmp") MaskImage tile4, 255, 0, 255 Global dude = LoadAnimImage ("dude.bmp", 32,32, 0,2) MaskImage dude, 255, 0, 255 Global wl = LoadAnimImage ("weapon1l.bmp", 32,32, 0,5) MaskImage wl, 255, 0, 255 Global wr = LoadAnimImage ("weapon1r.bmp", 32,32, 0,5) MaskImage wr, 255, 0, 255 Global Gegner1 = LoadAnimImage ("gegner1.bmp", 32,32, 0,2) MaskImage Gegner1, 255, 0, 255 Global coin = LoadImage ("coin.bmp") MaskImage coin, 255, 0, 255 Global title = LoadImage ("title.bmp") ;Sounds Global gain = LoadSound("gain.wav") Global death = LoadSound("die.wav") Global hit = LoadSound("sword1.wav") Global Player_pos_x = 64 Global Player_pos_y = 320 Global Player_temp_y# = 0 Global Player_dir = 1 Global jump Global jumptimer# Global atk = 5 Const rechts = 205, links = 203, strg = 157, shift = 54 Dim map (20,15) Restore mapdata For y=0 To 14 For x=0 To 19 Read map(x,y) Next Next Global anzahl=0 Global info.coin Type coin Field Pos_x Field Pos_y End Type Global info2.Gegner Type Gegner Field Gegnertype Field Pos_x Field Pos_y Field Richtung End Type Dim map (20,15) Restore mapdata For y=0 To 14 For x=0 To 19 Read map(x,y) Next Next Restore coin_level1 Read anzahl For i = 1 To anzahl info.coin = New coin Read x,y info\Pos_x = x info\Pos_Y = y Next Restore monster_level1 Read anzahl For i = 1 To anzahl info2.Gegner = New Gegner Read Gegnertype, x, y, richtung info2\Gegnertype = Gegnertype info2\Pos_x = x info2\Pos_y = y info2\Richtung = Richtung Next ;Title Screen Repeat Cls DrawImage title, 0,0 Text 300,290,"Drücke Leertaste zum Starten",1,1 If gehoert = 0 Then PlayMusic "title_m.mid" gehoert = 1 EndIf Until KeyHit (57) ClsColor 0,0,255 ;Hauptschleife Repeat Cls WaitTimer (frametimer) DrawMap() MoveDude() DoJump() DrawCoin() DrawPlayer() MoveGegner() DrawGegner() Attack() Collision() Flip Until KeyHit (1) End ;Functionen Function DrawMap() For y = 0 To 14 For x = 0 To 19 If map(x,y) = 1 Then DrawImage tile, x*32, y*32 ElseIf map(x,y) = 2 Then DrawImage tile2, x*32, y*32 ElseIf map(x,y) = 3 Then DrawImage tile3, x*32, y*32 ElseIf map(x,y) = 4 Then DrawImage tile4, x*32, y*32-160 EndIf Next Next End Function Function MoveDude() If KeyDown(links) Then Player_dir = 0 If map(Player_pos_x /32,(Player_pos_y +16) /32)=0 Then Player_pos_x = Player_pos_x -4 If Player_pos_x =< 0 Then Player_pos_x = 1 EndIf ElseIf KeyDown(rechts) Then Player_dir = 1 If map((Player_pos_x +32) /32,(Player_pos_y +16) /32)=0 Then Player_pos_x = Player_pos_x +4 If Player_pos_x => 608 Then Player_pos_x = 607 EndIf EndIf End Function Function DoJump() If KeyDown (shift) Then If jump = False jump = True Player_temp_y = 9 EndIf EndIf If map((Player_pos_x +16) /32,Player_pos_y /32)=1 And jump = True Then jump = False Player_pos_y = Player_pos_y +1 EndIf If jump = True Then Player_temp_y = Player_temp_y -0.33 Player_pos_y = Player_pos_y - Player_temp_y If Player_temp_y =< 0 Then If map((Player_pos_x +16) /32,(Player_pos_y +32) /32)=1 Or map((Player_pos_x +16) /32,(Player_pos_y +32) /32)=2 Then jump = 0 temp = Player_pos_y /32 Player_pos_y = temp *32 EndIf EndIf EndIf If jump = False Then If map((Player_pos_x +16) /32,(Player_pos_y +32) /32)=0 Then jump = True Player_temp_y = 0 EndIf EndIf If Player_pos_y =< 0 Then Player_pos_y = 1 jump = True Player_Temp_y = 0 EndIf If Player_pos_y => 448 Then Player_pos_y = 447 jump = False EndIf End Function Function DrawPlayer() If Player_dir = 1 Then DrawImage dude, Player_pos_x, Player_pos_y, 1 ElseIf Player_dir = 0 Then DrawImage dude, Player_pos_x, Player_pos_y, 0 EndIf End Function Function DrawCoin() For info.coin = Each coin DrawImage coin, info\Pos_x, info\Pos_y Next End Function Function DrawGegner() For info2.Gegner = Each Gegner If info2\Gegnertype = 1 Then If info2\Richtung = 0 Then DrawImage Gegner1, info2\Pos_x, info2\Pos_y, 0 ElseIf info2\Richtung = 1 Then DrawImage Gegner1, info2\Pos_x, info2\Pos_y, 1 EndIf EndIf Next End Function Function MoveGegner() For info2.Gegner = Each Gegner If info2\Gegnertype = 1 Then If info2\Richtung = 1 Then info2\Pos_x = info2\Pos_x +2 If map((info2\Pos_x +21) /32,(info2\Pos_y +32) /32)=0 Then info2\Richtung = 0 ElseIf map((info2\Pos_x +21) /32,(info2\Pos_y +16) /32)=1 Then info2\Richtung = 0 EndIf ElseIf info2\Richtung = 0 Then info2\Pos_x = info2\Pos_x -2 If map((info2\Pos_x +6) /32,(info2\Pos_y +32) /32)=0 Then info2\Richtung = 1 ElseIf map((info2\Pos_x +6) /32,(info2\Pos_y +16) /32)=1 Then info2\Richtung = 1 EndIf EndIf EndIf Next End Function Function Attack() If atk >= 5 Then atk = atk + 1 If KeyDown (strg) Then atk = 0 PlaySound hit EndIf ElseIf atk < 5 Then atk = atk + 1 If Player_dir = 1 Then DrawImage wr, Player_pos_x, Player_pos_y, frame ElseIf Player_dir = 0 Then DrawImage wl, Player_pos_x, Player_pos_y, frame EndIf frame = frame + 1 If frame = 5 Then frame = 0 EndIf End Function Function Collision() For info.coin = Each coin If ImagesCollide (coin, info\Pos_x, info\Pos_y, 0, dude, Player_pos_x, Player_pos_y, 0) Then PlaySound gain Delete info.coin EndIf Next For info2.Gegner = Each Gegner If info2\Gegnertype = 1 Then If ImagesCollide (Gegner1, info2\Pos_x, info2\Pos_y, 0, dude, Player_pos_x, Player_pos_y, 0) Then PlaySound death Player_pos_x = 64 Player_pos_y = 320 Player_temp_y# = 0 EndIf EndIf Next For info2.Gegner = Each Gegner If info2\Gegnertype = 1 Then If ImagesCollide (Gegner1, info2\Pos_x, info2\Pos_y, 0, wr, Player_pos_x, Player_pos_y, 0) Or ImagesCollide (Gegner1, info2\Pos_x, info2\Pos_y, 0, wl, Player_pos_x, Player_pos_y, 0)Then PlaySound death Delete info2.Gegner EndIf EndIf Next End Function ;Die Koordinaten der Karte werden hier gelesen ;0 = Nichts ;1 = Erde ;3 = Grasbewachsene Erde ;4 = Burg ;5 = Impossible to Move .mapdata Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 Data 0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0 Data 0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0 Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0 Data 0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 Data 0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0 Data 5,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 Data 5,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0 Data 5,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0 Data 5,5,0,0,0,0,0,0,0,0,0,2,2,2,0,0,0,0,1,0 Data 5,5,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,1,0 Data 4,5,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,1,0 Data 2,2,2,2,2,2,2,2,2,2,2,1,1,1,2,2,2,2,1,2 .coin_level1 Data 3 Data 11*32,10*32 Data 12*32,10*32 Data 13*32,10*32 .monster_level1 Data 2 Data 1, 14*32, 13*32, 1 Data 1, 11*32, 10*32, 1 sry das ich das ganze script eingfügt hab ![]() ich brauche schnell eine lösung für mein problem denn ich bin vor meinem pc am verzweifeln... ![]() |
||
ACHTUNG!!!
Newbiealarm: Ich habe erst vor kurzem mit dem programmieren von BB angefangen!!! |
![]() |
XeresModerator |
![]() Antworten mit Zitat ![]() |
---|---|---|
Man programmiert in Blitzbasic Code (weshalb es auch Code-Tags im Forum gibt, keine Script-Tags)...
Und in welchem Tutorium wird eigentlich Info.Typename verwendet? So eine Unsinnige Bezeichnung. Wenn man coin.Tcoin verwendet weiß man was in der coin variable ist, bei info, info1, ..., info23 weiß doch kein Schwein was für Objekte man da verwaltet. So, nun zur Fragestellung: Wenn die Schlagtaste gedrückt wird, wird eine Variable gesetzt, die angibt, das die Animation läuft. Mittels einer Timers (per millisecs ![]() Du kannst bei den ganzen Variablen für den Spieler auch diesen in einen Type packen, schafft Übersicht. |
||
Win10 Prof.(x64)/Ubuntu 16.04|CPU 4x3Ghz (Intel i5-4590S)|RAM 8 GB|GeForce GTX 960
Wie man Fragen richtig stellt || "Es geht nicht" || Video-Tutorial: Sinus & Cosinus THERE IS NO FAIR. THERE IS NO JUSTICE. THERE IS JUST ME. (Death, Discworld) |
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group