Results 1 to 5 of 5

Thread: New member, and a question

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2002
    Location
    Palmdale, Cali
    Posts
    4

    New member, and a question

    Hello everyone. Im Adam...and now that intro's are over, serious stuff(as if sitting on my ass all day programming games noone will ever see is serious anyways)

    I am programming a 2d side-scrolling platformer. I have a functioning gravity routine, sort-of, which brings me to my problem. I have it checking the bottom left portion of the sprite for detection, but I need it to use the whole bottom of the sprite. I have tried a few things, but to no prevail. Any ideas, or some sample code?

  2. #2
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Can you explain some more ?
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 2002
    Location
    Palmdale, Cali
    Posts
    4
    Sure...I have it where when the player is falling, it stopps when the player's bottom leftt pixel hits a platform:

    @@@@
    @@@@
    @@@@
    X@@@

    I want to be able to check for the whole bottom of the player, not just the one coordinate. I tried looping through each of the bottom pixels, but that was both slow, and ineffective. Any ideas? even some random guesses, or pseudo code would help at this point...Im pretty spent on ideas.

  4. #4
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Well there's nothing wrong with checking all bottom pixels.
    There's a few collision detection examples on the net.
    Check out "unlimited realites" in new zealand.
    I think they have a few good tutorials on it.

    Anyway.
    Bear in mind the fact that you always know what the bottom of the player looks like.
    So you know that the co-ordinates for the bottom of the player are always gonig to be an off-set of the centre of the player.
    Either that or you could just keep a list of the co-ordinates of those positions.

    But as I was saying, you will always know where the bottom of the player is.
    So just pre-record those co-ordinates, and then each time you iterate the game loop, run through that list of known co-ordinates and check if any of the environment is also in those areas.


    Another tihng you could do is just not check down to the pixel level.
    Eg. just decide on a box around your player, and then just check if that box overlaps with the environment.
    That would be by far the easiest approach.
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  5. #5

    Thread Starter
    New Member
    Join Date
    Aug 2002
    Location
    Palmdale, Cali
    Posts
    4
    *WooHoo* for me....Yeah....finally got it working! After so many months, it feels good to do something right every now and then...lol

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