Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

102 Neutral

About KaiSkews

  • Rank
  1. KaiSkews

    C# - Merging two sorted arrays - merge sort

    Hms... arent all those while loops infinite ? while (RightPtr <= RightEnd) { .... } Is always true when it's not altered in the while loop... So it keeps on copying the array until it goes out of range. Correct me please if i'm wrong.
  2. Try this void Player::SetClips() { //Set clips for healthbar for( int i = 0; i < 12; i++ ) { healthbarClips = new SDL_Rect; healthbarClips->x = 0; healthbarClips->y = 22 * i; healthbarClips->h = 22; healthbarClips->w = 374; } } don't forget to deallocate the memory for preventing memory leaks
  3. KaiSkews

    2D Movement

    GetAsyncKeyState() was the key, thanks. Works like a charm.
  4. Ok, for those who are interested : There seems to be some problems with Graphics::TBitmap->CopyRect(...) and Graphics::TBitmap->Transparent = true; I solved it by first CopyRect(...) ing the Sprite into a separate TBitmap and than Graphics::TBitmap->Draw(...) ing that bmp to the buffer. Skyskewz
  5. Push plx Not even a view yet... Was trying around with ScanLine until I finally gave that up because it takes like years to calculate all that pixels.
  6. Hi, me again... As the title says, i'm having troubles with Graphics::TBitmap->TransparentColor. What my game does (concerning this problem, all in pseudo code): Make 1 Buffer for Background, draw background on it. Once.(BgBuffer) For every frame, make 1 Buffer for Objects, draw Objects on it. (ObjBuffer) For every frame, make 1 Buffer, draw BgBuffer then ObjBuffer, then draw to screen. Now my problem. For ObjBuffer i do: ObjBuffer->Brush->Color = Magenta ObjBuffer->TransparentColor = Magenta ObjBuffer->Rectangle(0,0,width,height) ObjBuffer->DrawObjectsWithMagentaBackgroundOnMe Buffer->DrawBgBufferOnMe Buffer->DrawObjBufferOnMe The Problem is the following. As 2 objects with magenta background lie one over another, the one that lies behind is made invisible, because the magenta background of the topmost lies over it. I'd not say that there is any problem when i would read this, because i'd say "it's like that, look for another possibility". The crazy thing is that I have one object where it actually works ! But there is no difference in coding I can see... Is there something i may have missed ? I'd love to hear from you guys, until now you could solve all that little riddles that made me crazy for days! Thanks in advance !
  7. KaiSkews

    Trouble moving sprites

    I'm not 100% sure what that "spriteField" is, but when it is what I think, say a List of all the sprites, then your for loop may be the problem. Try : for ( int i = 0; i <= spriteField.size(); i++) So it iterates correctly through all the Sprites, otherwise it will forget the last one. ( <= instead of <)
  8. KaiSkews

    2D Movement

    Oh I see... good point. Tried several other possibilities for key input, they all have the same problem. I'll report back when i figured it out. Thanks !
  9. KaiSkews

    2D Movement

    Hi, me again having troubles, again. I'm still working on my 2D Topview game. I'm having problems with the movement. The movement itself looks fluently, even if it could be approved at some points but thats for later. What really **** is that, when i go in one direction, then change the direction the player stops for about a second before moving again. I don't know where that should come from. The keyboard input is done by WindowProc and the Movement Function is about this : (shortened) void KCharacter::Move() { switch(Direction) { case 0: y += 5; this->DrawCharacter(); .... } Someone got an idea ? Thanks in advance !
  10. KaiSkews

    Slope problem

    Woohoo, thanks works godlike. Lovely. Thank you!!
  11. KaiSkews

    Slope problem

    Hello all you game programmers, I've got a small problem you may help me out with. I'm designing a small game, actually for learning purpose only. It's a 2D one-background game (style Picking Sticks), where you can run around and shoot bullets to enemys as you have a small crosshair controlled by mouse and the character controlled by keyboard. My problem is the following: As i shoot the bullets, they go faster when the slope of their travelling direction goes either too far up or too far down. To express this mathematically: Character (Xa, Ya) Crosshair (Xb, Yb) DirectionVertex_X = Xb-Xa DirectionVertex_Y = Yb-Ya DirectionVertex_Slope = DirectionVertex_Y/DirectionVertex_X Now that we have the DirectionVertex we can calculate every step of the bullet: Bullet->x += 1 Bullet->y += DirectionVertex_Slope*1 maybe you can see the problem already. the more Y drifts away from X the greater the steps for Y become when they stay constant for X. so the speed becomes greater the further I aim up or down, and smaller the more X and Y are equal. I hope you understand my problem and may find an answer to it, maybe with a completely different approach. Thanks in advance
  • Advertisement

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!