Jump to content
  • Advertisement

JoshPike

Member
  • Content count

    9
  • Joined

  • Last visited

Community Reputation

100 Neutral

About JoshPike

  • Rank
    Newbie
  1. I am part of a team making a mod for UDK. the basic idea is that you start out with 500 points and lose 100 every time you die (when you get to 0 you cant spawn) and when you make it to a volume you "deposit" your points into your team's points the problem is that while I found the variable(s) that control the scores for the player and teams I cant seam to change them in ways that are helpful. there is no way I can see to change them in kismit. and I cant seam to even make a kismet function myself to change the team score. all I need is a node that has two inputs, player score and team number, and then changes teams[teamnumber].score to add the player score to it. I tried using http://forums.epicgames.com/showthre...t+unrealscript but I cant seam to make it link correctly. any ideas? or even any ideas on how to make a function in unrealscript trigger when a volume is hit, or even beter a kismet event to change team score?
  2. JoshPike

    SDL surface array problem

    I still dont know exactly what caused this but I just made a EXE to cut up my sprite sheet into the images, then load them ass needed, so that works.
  3. I cant seam to get to blit any surface from the many my constructor makes, its job is to take 15 images from a sprite sheet, cut them up, rotate each 360 times, save each to a surface array so i can use them later but whenever I try I cant seam to use my surfaces this does nothing; blit.ApplySurface( 0, 0, armsSurfaceArray[1][1], background, NULL,0,1 ); SDL_Flip( background); constructor SDL_Surface *torsoSurfaceArray[7][361]; SDL_Surface *armsSurfaceArray[7][361]; SDL_Surface *legsSurfaceArray[7][361]; //intitalizes SDL, and sets all surfaces Surface::Surface() { const int SCREEN_WIDTH = 500; const int SCREEN_HEIGHT = 400; const int SCREEN_BPP = 32; TTF_Init(); SDL_Init( SDL_INIT_EVERYTHING ); background = SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE ); SDL_WM_SetCaption( "running", NULL ); //sets all surfaces to NULL for (int i= 1; i < 7; i++) { for (int j= 0; j < 360; j++) { torsoSurfaceArray[j] = background; armsSurfaceArray[j] = background; legsSurfaceArray[j] = background; } } int spriteCutWidth = 187; int spriteCutHight = 100; int spriteXcords[6]; spriteXcords[1] = 119; spriteXcords[2] = 312; spriteXcords[3] = 507; spriteXcords[4] = 701; spriteXcords[5] = 895; int spriteYcords[4]; spriteYcords[1] = 351; spriteYcords[2] = 479; spriteYcords[3] = 608; SDL_Rect spriteCut[6]; SDL_WM_SetCaption( "Loading...", NULL ); SDL_Surface *playerSpriteSheetImg = IMG_Load( "debug/Generic_Images/player_sprite_sheet.tga" ); //going through once for every stride for (int i= 1; i < 6; i++) { //360 times, one for each angle for (int j= 0; j < 5; j++) { spriteCut.h = spriteCutHight; spriteCut.w = spriteCutWidth; spriteCut.x = spriteXcords; spriteCut.y = spriteYcords[2]; blit.ApplySurface( 0, 0, playerSpriteSheetImg, torsoSurfaceArray[j], &spriteCut,j,1 ); //blit.ApplySurface( 0, 0, background, torsoSurfaceArray[j], NULL,0,1 ); //SDL_FreeSurface( background ); spriteCut.y = spriteYcords[3]; blit.ApplySurface( 0, 0, playerSpriteSheetImg, legsSurfaceArray[j], &spriteCut,j,1 ); //blit.ApplySurface( 0, 0, background, legsSurfaceArray[j], NULL,0,1 ); //SDL_FreeSurface( background ); spriteCut.y = spriteYcords[1]; blit.ApplySurface( 0, 0, playerSpriteSheetImg, armsSurfaceArray[j], &spriteCut,j,1 ); //blit.ApplySurface( 0, 0, background, armsSurfaceArray[j], NULL,0,1 ); //SDL_FreeSurface( background ); } } } apply surface funtion used in above void Surface::ApplySurface( int x, int y, SDL_Surface* source, SDL_Surface* destination, SDL_Rect* clip, int angle, int zoom) { SDL_Rect offset; offset.x = x; offset.y = y; if (angle != 0) { source = rotozoomSurface(source, angle, 1, 1); } if (zoom != 1) { source = rotozoomSurface(source, 0, zoom, 1); } SDL_BlitSurface( source, clip, destination, &offset ); } ------- EDIT; doing some testing, there seams to be somthing inheritly wrong with what i am doing, this returns a blank surface, unless I dont use spriteCutTest (dont cut the image) then it works for about 60 frames then disapears, and stops loading the image (games speeds up) SDL_Surface *Surface::PlayerIcon(int stride, string direction) { SDL_FreeSurface( background ); SDL_Rect spriteCutTest; spriteCutTest.x = 20; spriteCutTest.y = 20; spriteCutTest.h = 200; spriteCutTest.x = 400; SDL_Surface *playerSpriteSheetImgTest = IMG_Load( "debug/Generic_Images/player_sprite_sheet.tga" ); blit.ApplySurface( 0, 0, playerSpriteSheetImgTest, background, &spriteCutTest,20,1 ); //blit.ApplySurface( 0, 0,torsoSurfaceArray[1][1], background, NULL,0,1 ); return background; } code that is puting the surfaces together; void Surface::EntireDisplay(int playerHighLevel,SDL_Rect levelRect, string direction) { //map SDL_Surface *levelDisplay = blit.VisualLevelSurface(levelRect); blit.ApplySurface( 0, 0, levelDisplay, background, NULL,0,1 ); SDL_FreeSurface( levelDisplay ); SDL_Surface *personDisplay = blit.PlayerIcon(stride,direction); blit.ApplySurface( 0, 0, personDisplay, background, NULL,0,1 ); SDL_FreeSurface( personDisplay ); //fliping, only place this should be SDL_Flip( background); SDL_FreeSurface( background ); } [Edited by - JoshPike on December 4, 2009 11:13:50 AM]
  4. JoshPike

    SDL .png problem

    thanks alot, that also explains odd things in other places in my code (things not bliting right, but not so much as to be that bad)
  5. JoshPike

    SDL .png problem

    ya its from lazy foo. void Surface::ApplySurface( int x, int y, SDL_Surface* source, SDL_Surface* destination, SDL_Rect* clip) { SDL_Rect offset; offset.x = x; offset.y = y; SDL_BlitSurface( source, clip, destination, &offset ); } so what your saying is that I make say screen = SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE ); do that once, then write to that surface, flip it, clear it, repeat? [Edited by - JoshPike on December 1, 2009 10:28:19 AM]
  6. JoshPike

    SDL .png problem

    no I am using SDL_SetVideoMode for all my main surfaces, but now that you mention it SDL_SWSURFACE might be worth looking at, or changing in my constructor for my surface class const int SCREEN_WIDTH = 1050; const int SCREEN_HEIGHT = 750; const int SCREEN_BPP = 32; TTF_Init(); SDL_Init( SDL_INIT_EVERYTHING ); screen = SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE ); backgroundScreen = SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE ); combatLogScreen = SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE ); hpBarScreen = SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE ); combatView = SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE ); cooldown = SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE ); dotScreen = SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE ); vitalityOverlay = SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE ); mapScreen = SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE );
  7. JoshPike

    SDL .png problem

    I have been working on it and the problem definitly happens when I cut the image from the sprite sheet, when I try to do anything with the alpla or with color keying after that it gives a error "Unhandled exception at 0x0040c67d in Pikeville.exe: 0xC0000005: Access violation reading location 0x00000004." anyone have any idea's? I cant find anything on google, and I am stumped, if i cant get this fixed I wont be able to use sprite sheets at all. it just boggles the mind why sdl would act like the surface that is being used underneithe my cut one is a mask, or why it wont let me do anything to the alpha of my image [Edited by - JoshPike on November 29, 2009 12:29:08 PM]
  8. JoshPike

    SDL .png problem

    what i am doing is setting the three surfaes I am getting from my sprite sheet first equal to a white square, then puting the image from the sprite sheet on them, if I dont do that then I cant see the images at all SDL_Surface *spriteSheet = NULL; SDL_Surface *icon_Right = NULL; SDL_Surface *icon_Left = NULL; SDL_Surface *icon_Mid = NULL; string clearSquareTxt = "debug/Images/Map/Clear_Square.png"; SDL_Rect spriteCut[ 3 ]; SDL_Surface *playerIcon = NULL; SDL_Surface *iconNorth_Mid = NULL; SDL_Surface *iconNorth_Right = NULL; SDL_Surface *iconNorth_Left = NULL; SDL_Surface *iconNorthEast_Mid = NULL; SDL_Surface *iconNorthEast_Right = NULL; SDL_Surface *iconNorthEast_Left = NULL; SDL_Surface *iconEast_Mid = NULL; SDL_Surface *iconEast_Right = NULL; SDL_Surface *iconEast_Left = NULL; SDL_Surface *iconSouthEast_Mid = NULL; SDL_Surface *iconSouthEast_Right = NULL; SDL_Surface *iconSouthEast_Left = NULL; SDL_Surface *iconSouth_Mid = NULL; SDL_Surface *iconSouth_Right = NULL; SDL_Surface *iconSouth_Left = NULL; SDL_Surface *iconSouthWest_Mid = NULL; SDL_Surface *iconSouthWest_Right = NULL; SDL_Surface *iconSouthWest_Left = NULL; SDL_Surface *iconWest_Mid = NULL; SDL_Surface *iconWest_Right = NULL; SDL_Surface *iconWest_Left = NULL; SDL_Surface *iconNorthWest_Mid = NULL; SDL_Surface *iconNorthWest_Right = NULL; SDL_Surface *iconNorthWest_Left = NULL; ------------------ icon_Right = IMG_Load( clearSquareTxt.c_str() ); icon_Left = IMG_Load( clearSquareTxt.c_str() ); icon_Mid = IMG_Load( clearSquareTxt.c_str() ); ------------------ SDL_Surface *testImg = NULL; //first time this funtinon has been used if (firstUse) { //loads up correct sprite sheet if (playerRace == "Gnome") { spriteSheet = gnomeSpriteSheetImg; } else if (playerRace == "Human") { spriteSheet = humanSpriteSheetImg; } else if (playerRace == "Orc") { spriteSheet = orcSpriteSheetImg; } else if (playerRace == "Elf") { spriteSheet = elfSpriteSheetImg; } //loads 3 base sprites int spriteCutWidth = 32; int spriteFirstSquareX = 70; int spriteSecondSquareX = 129; int spriteThirdSquareX = 191; int spriteFinalY = 0; int spriteFirstSquareY = 3; int spriteSecondSquareY = 67; int spriteThirdSquareY = 135; int spriteFourthSquareY = 197; if (playerClass == "Mage") { spriteFinalY = spriteFirstSquareY; } else if (playerClass == "Cleric") { spriteFinalY = spriteSecondSquareY; } else if (playerClass == "Warrior") { spriteFinalY = spriteThirdSquareY; } else if (playerClass == "Thief") { spriteFinalY = spriteFourthSquareY; } spriteCut[ 0 ].x = spriteFirstSquareX; spriteCut[ 0 ].y = spriteFinalY; spriteCut[ 0 ].w = spriteCutWidth; spriteCut[ 0 ].h = spriteCutWidth; spriteCut[ 1 ].x = spriteSecondSquareX; spriteCut[ 1 ].y = spriteFinalY; spriteCut[ 1 ].w = spriteCutWidth; spriteCut[ 1 ].h = spriteCutWidth; spriteCut[ 2 ].x = spriteThirdSquareX; spriteCut[ 2 ].y = spriteFinalY; spriteCut[ 2 ].w = spriteCutWidth; spriteCut[ 2 ].h = spriteCutWidth; blit.ApplySurface( 0, 0, spriteSheet, icon_Right,&spriteCut[ 0 ] ); blit.ApplySurface( 0, 0, spriteSheet, icon_Mid,&spriteCut[ 1 ] ); blit.ApplySurface( 0, 0, spriteSheet, icon_Left,&spriteCut[ 2 ] ); //rotation icon and setting up class image vars //mid iconEast_Mid = rotozoomSurface(icon_Mid, 0, 1, 1); iconSouthEast_Mid = rotozoomSurface(icon_Mid, 45, 1, 1); iconSouth_Mid = rotozoomSurface(icon_Mid, 90, 0, 1); iconSouthWest_Mid = rotozoomSurface(icon_Mid, 135, 1, 1); iconWest_Mid = rotozoomSurface(icon_Mid, 180, 1, 1); iconNorthWest_Mid = rotozoomSurface(icon_Mid, 225, 1, 1); iconNorth_Mid = rotozoomSurface(icon_Mid, 270, 1, 1); iconNorthEast_Mid = rotozoomSurface(icon_Mid, 315, 1, 1); //right iconEast_Right = rotozoomSurface(icon_Right, 0, 1, 1); iconSouthEast_Right = rotozoomSurface(icon_Right, 45, 1, 1); iconSouth_Right = rotozoomSurface(icon_Right, 90, 0, 1); iconSouthWest_Right = rotozoomSurface(icon_Right, 135, 1, 1); iconWest_Right = rotozoomSurface(icon_Right, 180, 1, 1); iconNorthWest_Right = rotozoomSurface(icon_Right, 225, 1, 1); iconNorth_Right = rotozoomSurface(icon_Right, 270, 1, 1); iconNorthEast_Right = rotozoomSurface(icon_Right, 315, 1, 1); //Left iconEast_Left = rotozoomSurface(icon_Left, 0, 1, 1); iconSouthEast_Left = rotozoomSurface(icon_Left, 45, 1, 1); iconSouth_Left = rotozoomSurface(icon_Left, 90, 0, 1); iconSouthWest_Left = rotozoomSurface(icon_Left, 135, 1, 1); iconWest_Left = rotozoomSurface(icon_Left, 180, 1, 1); iconNorthWest_Left = rotozoomSurface(icon_Left, 225, 1, 1); iconNorth_Left = rotozoomSurface(icon_Left, 270, 1, 1); iconNorthEast_Left = rotozoomSurface(icon_Left, 315, 1, 1); the corret surface is then passed out of the function and blit, but that part works fine and is long so I did not put it here [Edited by - JoshPike on November 29, 2009 12:59:33 PM]
  9. JoshPike

    SDL .png problem

    I use alot of .png's in my game with transparency, up till now it has not caused a issue. but when I put the surface I made from part of a sprite sheet (the sheet, uncut, works fine) it seams to need a surface behind it with non transparent pixels, it seams to act like the image behind it is a alpha channel, if I put a dot in the middle of the image behind it that only within that dot will the top image show. and yes this was as much of a bitch to figure out as it sounds
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!