Snake hat Tail und Farben angepasst

This commit is contained in:
Julia09055x 2023-12-10 21:05:11 +01:00
parent 72ca020f27
commit 2d953e1e1b

View File

@ -13,63 +13,57 @@ void renderGame(){
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
SDL_RenderClear(renderer);
//Head__________________________________________________
SDL_SetRenderDrawColor(renderer, 0, 200, 100, 255); //RGB-Farbe Kopf
SDL_Rect rect;
SDL_Rect rect; //Rechteck anlegen
rect.w = config.blockSizePx; //Breite festlegen
rect.h = config.blockSizePx; //Höhe festlegen
//_______Head kreieren__________________________________________________
SDL_SetRenderDrawColor(renderer, 0, 255, 0, 255); //RGB-Farbe Kopf
rect.x = (game.snake.headX * config.blockSizePx); //Abstand links
rect.y = (game.snake.headY * config.blockSizePx); //Abstand rechts
rect.w = config.blockSizePx;
rect.h = config.blockSizePx;
SDL_RenderFillRect(renderer, &rect); //Rechteck rendern
//Snake-Baustein kreieren_________________________________________________________________
for(int i = 1; i>game.snake.length; i++){
SDL_SetRenderDrawColor(renderer, 0, 255, 0, 255); //RGB-Farbe Tail
SDL_Rect rect;
//______Tail kreieren_________________________________________________________________
for(int i = 1; i<game.snake.length; i++){
SDL_SetRenderDrawColor(renderer, 15, 179, 15, 255); //RGB-Farbe Tail
rect.x = (game.snake.tail[i][0] * config.blockSizePx); //Abstand links
rect.y = (game.snake.tail[i][0] * config.blockSizePx); //Abstand rechts
rect.w = config.blockSizePx;
rect.h = config.blockSizePx;
rect.y = (game.snake.tail[i][1] * config.blockSizePx); //Abstand rechts
SDL_RenderFillRect(renderer, &rect); //Rechteck rendern
}
//Portal kreieren________________________________________________________________________
//______Portal kreieren________________________________________________________________________
for (int i = 0; i < game.map.portalCount; i++)
{
SDL_SetRenderDrawColor(renderer, 0, 100, 255, 255); //RGB-Farbe Portal
//Start-Portal
SDL_SetRenderDrawColor(renderer, 0, 191, 255, 255); //RGB-Farbe Start-Portal
rect.x = (game.map.portals[i].posX * config.blockSizePx);
rect.y = (game.map.portals[i].posY * config.blockSizePx);
SDL_RenderDrawRect(renderer, &rect); //Rechteck rendern
//Ausgangs-Portal
SDL_SetRenderDrawColor(renderer, 0, 0, 200, 255); //RGB-Farbe Start-Portal
rect.x = (game.map.portals[i].targetX * config.blockSizePx);
rect.y = (game.map.portals[i].targetY * config.blockSizePx);
SDL_RenderDrawRect(renderer, &rect); //Rechteck rendern
}
//Food kreieren_________________________________________________________________________
SDL_SetRenderDrawColor(renderer, 255, 0, 255, 255); //RGB-Farbe Food
//_______Food kreieren_________________________________________________________________________
SDL_SetRenderDrawColor(renderer, 255, 165, 0, 255); //RGB-Farbe Food
rect.x = (game.foodX*config.blockSizePx); //Abstand links
rect.y = (game.foodY* config.blockSizePx); //Abstand rechts
rect.w = config.blockSizePx;
rect.h = config.blockSizePx;
SDL_RenderFillRect(renderer, &rect); //Rechteck rendern
SDL_RenderDrawRect(renderer, &rect); //Rechteck rendern
//Collisions kreieren_________________________________________________________________________
//______Collisions kreieren_________________________________________________________________________
for(int i = 0; i < game.map.collisionCount; i++){
SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255); //RGB-Farbe Wand
SDL_SetRenderDrawColor(renderer, 112, 128, 144, 255); //RGB-Farbe Wand
rect.x = (game.map.collisions[i].posX*config.blockSizePx); //Abstand links
rect.y = (game.map.collisions[i].posY* config.blockSizePx); //Abstand rechts
rect.w = config.blockSizePx;
rect.h = config.blockSizePx;
SDL_RenderFillRect(renderer, &rect); //Rechteck rendern
}