Werbeanzeige
![]() |
C-/C++-Quelltext |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
PROCEDURE WalkRight(); VAR check, check2: BOOLEAN; temp: INTEGER; BEGIN (* Jedes Bild wird 6 mal gezeichnet Dabei werden Forschleifen zur Schrittweisen Erhöhung der X-Koordinate verwendet! *) check := C.KeyPressed(); IF check = FALSE THEN m := m + 2; FOR temp := 0 TO 15 BY 2 DO C.Clear(); (* Vorheriges Bild löschen! *) CFct.Picture("r0.BMP", m, 0, 10); (* Zeichne das Bild für XXms *) IF m > 768 THEN m := 768; END; END; check2 := TRUE; END; check := C.KeyPressed(); IF check = TRUE THEN FOR j := m TO (m+15) BY 2 DO C.Clear(); (* Vorheriges Bild löschen! *) CFct.Picture("r0.BMP", j, 0, 10); (* Zeichne das Bild für XXms *) IF m > 768 THEN m := (m+16); END; END; FOR k := j TO (j+15) BY 2 DO C.Clear(); IF k > 768 THEN k := (j+15); END; CFct.Picture("r1.BMP", k, 0, 10); END; END; IF check = TRUE THEN FOR l := k TO (k+15) BY 2 DO C.Clear(); CFct.Picture("r2.BMP", l, 0, 10); IF l > 768 THEN l := (k+16); END; END; END; IF check = TRUE THEN FOR m := l TO (l+15) BY 2 DO C.Clear(); CFct.Picture("r1.BMP", m, 0, 10); IF m > 768 THEN m := (l+16); END; END; END; C.Clear(); CFct.Picture("r.BMP", m, 0, 0); (* Keen bleibt stehen *) END WalkRight; |
![]() |
Quellcode |
1 |
CFct.Picture : (Dateiname, x, y, Sleepzeit) |
![]() |
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
PROCEDURE DisplayPunkt*(newx, newy: INTEGER); BEGIN (* Hintergrund *) C.SetForeColor(168,168,168); C.Bar(1+newx,1+newy,16+newx,16+newy,1); CFct.Color(0,15); C.Bar(3+newx,7+newy,14+newx,14+newy,1); C.Bar(13+newx,8+newy,14+newx,9+newy,1); C.Bar(14+newx,10+newy,15+newx,11+newy,1); C.Bar(13+newx,12+newy,14+newx,13+newy,1); C.SetForeColor(252,84,84); C.Bar(4+newx,7+newy,13+newx,14+newy,1); C.Line(6+newx,6+newy,9+newx,6+newy,1); C.Line(6+newx,15+newy,9+newx,15+newy,1); C.Line(3+newx,8+newy,3+newx,13+newy,1); C.Line(2+newx,10+newy,2+newx,11+newy,1); CFct.Color(0,15); C.Line(4+newx,12+newy,5+newx,12+newy,2); C.Line(5+newx,13+newy,6+newx,13+newy,2); C.Bar(8+newx,2+newy,9+newx,5+newy,2); C.Line(7+newx,1+newy,11+newx,1+newy,1); C.Line(7+newx,2+newy,7+newx,5+newy,1); C.Line(11+newx,2+newy,11+newx,5+newy,1); C.Line(6+newx,16+newy,11+newx,16+newy,1); C.Line(4+newx,15+newy,5+newx,15+newy,1); C.Line(12+newx,15+newy,13+newx,15+newy,1); C.Line(4+newx,6+newy,5+newx,6+newy,1); C.Line(12+newx,6+newy,13+newx,6+newy,1); C.Line(2+newx,8+newy,2+newx,9+newy,1); C.Line(2+newx,12+newy,2+newx,13+newy,1); C.Line(15+newx,8+newy,15+newx,9+newy,1); C.Line(15+newx,12+newy,15+newx,13+newy,1); C.Line(1+newx,10+newy,1+newx,11+newy,1); C.Line(16+newx,10+newy,16+newx,11+newy,1); C.Dot(6+newx,5+newy,1); C.SetForeColor(84,84,84); C.Line(10+newx,2+newy,10+newx,5+newy,1); C.SetForeColor(168,0,0); C.Line(10+newx,6+newy,11+newx,6+newy,1); C.Line(10+newx,15+newy,11+newx,15+newy,1); C.Line(12+newx,7+newy,13+newx,7+newy,1); C.Line(12+newx,14+newy,13+newx,14+newy,1); C.Bar(13+newx,8+newy,14+newx,9+newy,1); C.Bar(14+newx,10+newy,15+newx,11+newy,1); C.Bar(13+newx,12+newy,14+newx,13+newy,1); END DisplayPunkt; |
Anonymous
unregistriert
Zitat von »"nix da"«
Keen rulz! Bis auf der letzte Teil, der war ein Drama![]()
Aber Daumen hoch! Hau rein![]()
Anonymous
unregistriert
![]() |
C-/C++-Quelltext |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
class animation { public: animation (void) : num_frames_(4), frame_time_(250), passed_time_(0) {} void draw (long x, long y, unsigned long delta) { // Zeitzähler erhöhen passed_time_ += delta; // Frame ausrechnen den wir jetzt haben: curr_frame = passed_time_ / num_frame_; // Zeitzähler ordentlich halten ;) Darf also nicht größer als die Maximale Zeit werden if (passed_time_ > num_frames * passed_time) passed_time_ = num_frames * passed_time; // Frame jetzt anzeigen blablabla; } private: unsigned long curr_frame_; unsigned long num_frames_; unsigned long frame_time_; unsigned long passed_time_; }; |
![]() |
C-/C++-Quelltext |
1 2 |
// Timer Initialisieren oldTime_ = currTime_ = ::timeGetTime(); |
Anonymous
unregistriert
Werbeanzeige