Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!
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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
#include "DragonFireSDK.h" #include "WTlib.h" #include "Data.h" #include <math.h> #include "MyApp.h" int jumping1, jump_status, JumpSound; int OnTouchArea(int juTou, int event, int xTou, int yTou); ... static int RunAnimTable[32] = { 1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7 }; static int JumpAnimTable[24] = { 1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5 }; GameScreen::GameScreen() { pName = "GameScreen"; } GameScreen::~GameScreen() { } void GameScreen::enterScreen() { TouchAdd(0, 0, 480, 320, OnTouchArea, 0); ... trsX = 0; trsY = 237; trapS.init(RES_Trap_S_PNG,(int)trsX,0,0,0,pVM->view(cv++)); runX = 60; runY = 222; xAccel = yAccel = 0; run.init(RES_Run_01_PNG,(int)runX,(int)runY,(EF_CX|EF_CY),TRUE,pVM->view(cv++)); run.setAnim(RES_Run_01_PNG,RunAnimTable,ARRAY_LENGTH(RunAnimTable),TRUE); jump.init(RES_Jump_01_PNG,runX,runY,(EF_LX|EF_TY),TRUE,pVM->view(cv++)); jump.setAnim(RES_Jump_01_PNG, JumpAnimTable,ARRAY_LENGTH(JumpAnimTable),TRUE); ... trapS.moveBy(480,0); ... trapS.moveTo(x+480,trsY); ... trsX -= 7; if(trsX < -480) trsX += (480 * 2); trapS.moveTo(trsX+380,trsY); ... void GameScreen::onUpdate() { updateBackground(); int OnButton(int juid); char scoreBuffer[16]; score += 1; sprintf(scoreBuffer,"%05d",score); TextSetText(textLines[0],scoreBuffer); run.updateAnim(); ... int cv = firstView; int *pJumpAnimTable = JumpAnimTable; if(jumping1 == 1) { printf("test01"); if (jump_status == 3){ jump_status = 1; run.setVisible(FALSE); jump.setVisible(TRUE); jump.setAnim(RES_Jump_01_PNG, JumpAnimTable,ARRAY_LENGTH(JumpAnimTable),TRUE); } jump.updateAnim(); if(jump_status == 1) { printf("4Befor Up \n"); runY -= 15; if(runY < 120) { if(runY < 50) { jump_status = 2; printf("Up \n"); SoundPlay(JumpSound); } } } if(jump_status == 2) { runY += 8; printf("Air'n'Down \n"); if(runY > 145) { jumping1 = 0; jump_status = 0; printf("Down \n"); run.setVisible(TRUE); jump.setVisible(FALSE); } } jump.moveTo(runX, runY); } } int OnTouchArea(int juTou, int event, int x, int y) { JumpSound = SoundAdd("Sounds/JumpSound.snd"); if(juTou == 0) { jump_status = 3; jumping1 = 1; printf("JumpStatus = 1 \n"); } return 0; } ... GameOverScreen::GameOverScreen() { pName = "GameOverScreen"; } GameOverScreen::~GameOverScreen() { } ... |
Dieser Beitrag wurde bereits 2 mal editiert, zuletzt von »Waldfee« (26.01.2011, 13:15)
Community-Fossil
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »NachoMan« (26.01.2011, 14:36)
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »Waldfee« (27.01.2011, 15:14)
Community-Fossil
Community-Fossil
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 |
bool Rect::checkCollision(const Rect &rect) const { return (rect.Left <= Right && rect.Right >= Left && rect.Top <= Bottom && rect.Bottom >= Top); } |
Community-Fossil
Werbeanzeige