#177166 - Anubiss - Mon Jan 09, 2012 11:35 pm
Hey friends.
After moving into a new house i find time again for continuing what i begun.
The problems with my limits are away.
Now my ship is flying through the orbit. When it is close to a space-station i want an "options" window to appear. in this option window i wanna have the possibility to create or buy a new station. But after hours of thinking i don?t come to an end with how to do this in C.
I would be thankfull of any idea.
Here?s my code till now:
_________________
Fange nie an aufzuhoeren
Hoere nie auf anzufangen
After moving into a new house i find time again for continuing what i begun.
The problems with my limits are away.
Now my ship is flying through the orbit. When it is close to a space-station i want an "options" window to appear. in this option window i wanna have the possibility to create or buy a new station. But after hours of thinking i don?t come to an end with how to do this in C.
I would be thankfull of any idea.
Here?s my code till now:
Code: |
// Includes #include <PA9.h> #include "gfx/all_gfx.c" #include "gfx/all_gfx.h" int main(int argc, char ** argv) { PA_Init(); PA_InitVBL(); PA_EasyBgLoad(0, 1, aa); PA_InitText(1,0); PA_LoadSpritePal(0, 0, (void*)vaisseau_Pal); PA_LoadSpritePal(0, 1, (void*)station01_Pal); PA_CreateSprite(0, 0,(void*)vaisseau_Sprite, OBJ_SIZE_32X32,1, 0, 128-16, 96-16); // Das SChiff auf Mitte des unteren Screens setzen PA_SetSpriteRotEnable(0,0,0); u16 angle = 0; int x = (128) << 8; int y = (96) << 8; int sx; int sy; typedef struct{ int x; int xmax; int schalter; }pflanze; pflanze buche; buche.xmax=1000; buche.schalter=0; int scrollx = 0; int scrolly = 0; //Raumstation: ///////////////////////////////////////////////// typedef struct{ int x; int y; int flag; int entfx; int entfy; }station; station rs; //station fremd[10];//0-9 rs.x=200; rs.y=96; rs.flag=0; rs.entfx; rs.entfy; void station01test(void){ rs.entfx=(sx>>8)-(rs.x);//Entfernung zwischen Station und Raumschiff messen if (rs.entfx<0){rs.entfx=-rs.entfx;}//Betrag, falls Entfernung negativ! rs.entfy=(sy>>8)-(rs.y); if (rs.entfy<0){rs.entfy=-rs.entfy;} if (rs.flag==0){ PA_CreateSprite(0, 2,(void*)station01_Sprite, OBJ_SIZE_64X64,1, 1, rs.x-16, rs.y-16); rs.flag=1; } if ((rs.entfx>100)&&rs.flag==1){ PA_DeleteSprite (0, 2); rs.flag=0; } if ((rs.entfy>100)&&rs.flag==1){ PA_DeleteSprite (0, 2); rs.flag=0; } if ((rs.entfx<30)&&(rs.entfy<30)){ PA_OutputText(1,0,2,"'START' zum Landen-"); } if ((rs.entfx>30)||(rs.entfy>30)){ PA_OutputText(1,0,2," "); } } //Einfacher test: ///////////////////////////////////////////////// void wachse(void){ if (buche.schalter==1) if(buche.x<buche.xmax) buche.x++; if(buche.x==buche.xmax) buche.x=buche.xmax; } //STATUSBILDSCHIRM ////////////////////////////////////////////////////////////////// void statusscreen(void){ //Ausgabe von Informationen auf oberen Screen: //////////////////////////////////////////////////////////////////////////////// PA_OutputText(1,0,12,"Map-x: %02d", scrollx>>8); PA_OutputText(1,0,13,"Map-y: %02d", scrolly>>8); PA_OutputText(1,0,14,"-------------------"); PA_OutputText(1,0,15,"Schiff-x: %02d", sx>>8); PA_OutputText(1,0,16,"Schiff-y: %02d", sy>>8); PA_OutputText(1,0,17,"-------------------"); PA_OutputText(1,0,18,"x von Station entfernt: %02d", rs.entfx); PA_OutputText(1,0,19,"y von Station entfernt: %02d", rs.entfy); PA_OutputText(1,0,20,"Winkel des Schiffes: %02d", angle); } //MAIN: //////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// while (1) { //Test-Buche: z?hlt von 0 bis 1000, wenn "A" gedr?ckt wird if (Pad.Newpress.A) buche.schalter=1; wachse(); PA_OutputText(1,0,0,"%02d", buche.x); //Winkelberechnung-Flugschiff: /////////////////////////////////////////////////////////////////////////////// angle = PA_GetAngle(x>>8, y>>8, Stylus.X, Stylus.Y); // PA_SetRotsetNoZoom(0, 0, angle); // ?nderung des Schiffswinkels // //Flugschiff-Koordinaten AUSSERHALB DER ENGINE: sx=(scrollx+x); sy=(scrolly+y); //Hintergrund-Scrolling: ////////////////////////////////////////////////////////////////////////////// if(Pad.Held.B){ // scrollx += PA_Cos(angle); // scrolly += PA_Sin(angle); }; //Map-Grenzen: // if((scrollx>>8)>(2560-255)){ scrollx=590080; }; if((scrollx>>8)<0){ scrollx=0; }; if((-scrolly>>8)>(1600-191)){ scrolly=-360704; }; if((-scrolly>>8)<0){ scrolly=0; }; //Set-Map: PA_LargeScrollXY(0, 1, scrollx>>8, -scrolly>>8); statusscreen(); PA_SetSpriteXY(0, 0, (x>>8)-16, (y>>8)-16); PA_SetSpriteXY(0, 2, ((rs.x-16)+(-scrollx>>8))-16, ((rs.y-16)+(scrolly>>8))-16); station01test(); PA_WaitForVBL(); } return 0; } |
_________________
Fange nie an aufzuhoeren
Hoere nie auf anzufangen