Results 1 to 32 of 32

Thread: problem in a game's graphics

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2001
    Location
    Lebanon
    Posts
    90

    problem in a game's graphics

    Hello.
    I'm doing a Breakout-type game.
    Between level 1 and level 2 I've inserted another 1 level game.
    But when this one is over and the user goes to level 2 of the Breakout, the pad doesn't appear. If I take the "inter-game" out, the pad will appear normally, but when I include it, it disappears.
    Can anyone help me, please?
    Thank you.

  2. #2
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    Sorry Sandra but we can't help you in any way (at least I cant ) until you tell us what you're doing exactly... since you're new I suppose your pad is just a movind picturebox? Or are you using BitBlt or DDraw? When loading 2nd level what happens - do you just load another level map or do you re-init the whole window? *shrugs*

    *sigh*

  3. #3
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    Well I have blabber-vbworld-forum-talk to code powers

    Actually I think I know your problem.

    It lies in your initializing of the paddle (and maybe someother things), is the level name of the "inter-game" 1? If so then your paddle probably only iniializes on level1, or cannot be reinitialized for some reason. In any event, try destroying it then initializing it after, and if it doesn't work, post some code, as my powers are draining...
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Apr 2001
    Location
    Lebanon
    Posts
    90
    Fox:I'm using DDraw, and I reinit the whole map again.

    Sastraxi:I'll try unloading the picture and then loading it back again.

    The fact is that in my level 2, the pad is growing and shrinking back constantly, so I've mad a picture holding all the sizes, and each time I tell him which size, or which part of the image to take. I have seen this used somewhere, and I think it's better than putting each size in a picture by itself and then creating surfaces for all the sizes.
    So if I don't want my pad to grow and shrink, the level is working great.

    Did you understand what I'm saying?

    Thank you

  5. #5
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    Check the boundaries of Bitblt (if you are using that) that tell where to extract the image from. If you have a mistake in your algorithm that tells from what X,Y to what X,Y to take your paddle picture from the main image, the paddle will disappear altogether.
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Apr 2001
    Location
    Lebanon
    Posts
    90
    And if I ain't using BitBlt?

    Anyway, no my boundaries are right because if I take off the inter-game, everything is working fine.

  7. #7
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    Hm can you post the important part here?

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Apr 2001
    Location
    Lebanon
    Posts
    90
    I don't know what you mean by the important part, and besides I don't think there is a small part I can give you, I'll have to post the whole game??

  9. #9
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    I meant the part that is needed to see your problem, but posting the whole game would be even better..

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Apr 2001
    Location
    Lebanon
    Posts
    90
    The have attached is the whole game, i.e. code and pictures.
    It's a runnable version, though with some errors.
    If there's something you need to know, let me know.
    Attached Files Attached Files

  11. #11
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    Hm, I played the game, think I wrong-guessed the color but didn't have any problems with the pad...

  12. #12

    Thread Starter
    Lively Member
    Join Date
    Apr 2001
    Location
    Lebanon
    Posts
    90
    In level 1 there's no problem with the pad. It's in level 2, if you guess the color.

  13. #13
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Hey sandra, we have the same birthday.

    ... 'cept you're three years older than me ...
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  14. #14

    Thread Starter
    Lively Member
    Join Date
    Apr 2001
    Location
    Lebanon
    Posts
    90
    WAW!

  15. #15
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    Checking out people's biographies, Plenderj? Is that legal?
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  16. #16
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    (Sorry for bringing you only bad new but anyway all of them have an easy solution )

    It gave me the error "Out of Stack Space" when I hit one of the bricks, and the following line was in the immediate window:
    File Not Found: C:\Sandra's Game\Pictures\YBall.bmp
    But the file was there! Weird, huh? I tried it again and it worked...
    As to the out of stack space error, it probably happened because CheckCollision and MoveBall called each other a few thousand times straight, so maybe they shouldn't be able to do that.
    Here's the fix:

    Code:
    Dim MoveBallAgain As Boolean
    
    Public Sub MoveBall(mb As Integer)
      If mb = 0 Then
        Ball(mb).XPosition = Ball(mb).XPosition + Ball(mb).XSpeed
      Else
        Ball(mb).XPosition = Ball(mb).XPosition - Ball(mb).XSpeed
      End If
        Ball(mb).YPosition = Ball(mb).YPosition - Ball(mb).YSpeed
    TryAgain:
        MoveBallAgain = False
        Call CheckCollision(mb)
        If MoveBallAgain Then GoTo TryAgain
    End Sub
    
    Public Sub CheckCollision(cb As Integer)
    '...
    'Where it says "MoveBall (cb)", replace it with: "MoveBallAgain = True"
    End Sub
    That should work!

    Another thing... in some angles, the ball just rolls along the pad. No clue as how to fix it, sorry...

    Last one: you didn't give me enough time to see all the balls in the mini-game! I was reading the text when the balls disappeared...

    As to your problem... I've studied the code but I simply don't know what's wrong. It *should* work perfecly. But maybe you should try using Blt instead of BltFast, just in case... because Blt doesn't work sometimes while Blt does work. It can be your computer, not your code
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  17. #17

    Thread Starter
    Lively Member
    Join Date
    Apr 2001
    Location
    Lebanon
    Posts
    90

    Answering Jotaf98

    Hey!
    Don't worry about the bad news they aren't that bad.

    1-About the "Out of Stack" error, I don't know about it, it has never happened with me, but anyway I'll change the code.

    2-About the colors, yes you are right, the user doesn't have the time to read and check the colors, but I had already changed that before I read your post.

    3-About tha move of the ball on the pad, I'm aware of this problem, but neither do I know how to fix it. Anyway, I'll try to later.

    4-I'll try Blt in stead of Bltfast and let you know what happens.

    Thank you, and see ya!

  18. #18
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    Ok. Just don't forget to post here again so I get e-mailed about it
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  19. #19

    Thread Starter
    Lively Member
    Join Date
    Apr 2001
    Location
    Lebanon
    Posts
    90
    Unloading and loading the pictures is now working, but it didn't solve my problem (just to let you know )

  20. #20
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    (Sorry, but it seems that both of us are busy with other stuff )

    Hum... it should work... The out of stack error happens when you call a function too much times (like, function A calls B, B then calls A, that calls B that calls A that calls B...). If you don't immediately call them, but set a boolean variable so you'll call them later (so if you set the variable 100 times it will still call the function only 1), it shouldn't give you any of those errors.

    As to your problem: maybe you shouldn't unload the surfaces; instead, the main game loop stops so the inter-game runs, and then it restores the bricks, the balls left, adds 1 to the "level" variable, and continues running.
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  21. #21

    Thread Starter
    Lively Member
    Join Date
    Apr 2001
    Location
    Lebanon
    Posts
    90
    I'm sorry but I didn't quite get qhat you mean.

    So I get out of the main Do-loop, do my small game and then get back? Is that it?
    If it is, how do I do that?

  22. #22
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    It's easy, all you have to do is have another loop. The main loop will not continue until this one ends (the mine game ends)
    But don't forget to still flip to the backbuffer and all that kind of stuff. The main loop will not be running to handle that!

    Code:
    Do While Running
      'Game stuff goes here...
    
      If PlayMiniGame Then
        WonMiniGame = False
    
        'The mini game's main loop
        Do While PlayMiniGame
          'Mini game stuff goes here... when the player wins, WonMiniGame = True
    
          If WonMiniGame Then
            GameLevel = GameLevel + 1
            ReloadLevelBricks
            PlayerBallsLeft = 10
            PlayMiniGame = False 'To exit the mini game's loop
        Loop
      End If
    Loop
    Last edited by Jotaf98; May 23rd, 2001 at 10:48 AM.
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  23. #23

    Thread Starter
    Lively Member
    Join Date
    Apr 2001
    Location
    Lebanon
    Posts
    90
    It's not working

    I really don't know what to do anymore!

    I have another question:
    If I have the following code:

    Do
    If SomeCondition Then
    Newlevel
    Exit Do
    End if
    Loop

    Where NewLevel starts a new level, or starts doing something else,
    I haven't exited from the loop haven't I? Because the Game has entered the NewLevel procedire, and all its stuff, and hasn't stepped to the next command which is to axit the loop.

    Am I right?

  24. #24

    Thread Starter
    Lively Member
    Join Date
    Apr 2001
    Location
    Lebanon
    Posts
    90
    Hey!

    I have a question about the code you gave me:
    What's the difference between:

    Do
    'Anything
    Do
    'Something else
    end loop
    end loop

    and:

    Do
    'Anything
    SomeFunction
    end loop


    SomeFunction()
    Do
    'The same something else
    end loop
    end Somefunction

    Thank you.

  25. #25
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    Well, there is no difference at all

    Except that with a function the code is more readable, that's all. Just don't unload the surfaces. If you send me the code, I might be able to fix it...
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  26. #26

    Thread Starter
    Lively Member
    Join Date
    Apr 2001
    Location
    Lebanon
    Posts
    90
    I was thinking of something about my pad's problem.
    What do you think if I put each size in a picture by itself? Do you think it's a bad idea 'coz now I'll have lots of pictures and surfaces, especially that the pad changes size also in other future levels?

    Did you see what I mean?

  27. #27
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    Yes, it's a bad idea, the less images you have the better
    If you want to do it, there's no problem, because nowadays *most* computers have enough memory to handle it - but others don't, so...

    Anyway, sorry for not replying to your other post
    Yes, there isn't any difference. In VB, you can execute only 1 line at a time. Ifs, Loops and Fors just tell VB what line does it have to jump to when certain conditions are met. So, when you execute the function in the middle of the main loop, the function will execute first, and only then it continues with the main loop.

    To help you solving your problem: try using the second level's pad in the first level and see if it works. Then try using the first level's pad in the second level and see if it works.
    Last edited by Jotaf98; May 25th, 2001 at 11:46 AM.
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  28. #28

    Thread Starter
    Lively Member
    Join Date
    Apr 2001
    Location
    Lebanon
    Posts
    90
    Ok, it's working.
    But I don't want to change the pads, because now level 1 is more difficult than level 2.

  29. #29
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    Well, that was just to prove that the problem is not with the pads

    Still no clue as to your problem...
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  30. #30

    Thread Starter
    Lively Member
    Join Date
    Apr 2001
    Location
    Lebanon
    Posts
    90
    Thank you. This helped (I'm kidding)

    I was thinking of doing two different pictures. One normal pad, and another picture with all the different sizes for level2 and above. So in level 1 I load the first picture, and in level 2 I load the second one.
    Do you think it could solve the problem?

  31. #31

    Thread Starter
    Lively Member
    Join Date
    Apr 2001
    Location
    Lebanon
    Posts
    90
    Ii did not work!

    I'm fed up with this thing, I don't know what to do anymore!
    What am I supposed to do?

    Please Help!

  32. #32
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    Well, when I'm fed up with a program I either forget about it or try something DRASTIC

    If I was in your place, I'd make a backup of thw whole game in another folder, and then remove EVERYTHING until I had only the very basic first level... and then rebuild everything from that. Believe me, it's not as hard as it seems since you've got everything planned, and it saved me a lot of projects! Some of the problems were really dumb mistakes , others I never really found out what they were. They just worked when I rebuilt them

    Another way to do it would be: (I'm running out of ideas, you know? )

    Code:
    'Main loop
    RestartGame:
    Do While Running
      'Set Running = False when you wanna activate the mini-game
    Loop
    
    Do While MiniGameRunning
      'Run the minigame here...
    Loop
    
    Running = True
    Level = Level + 1
    
    GoTo RestartGame
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width