Make Sprite Jump Upon a Platform

Posted by Geore Shg on Game Development See other posts from Game Development or by Geore Shg
Published on 2012-04-07T23:56:07Z Indexed on 2012/04/08 5:48 UTC
Read the original article Hit count: 236

I have been struggling to make a game like Doodle Jump where the sprite jumps on a platform. So how do you make a sprite jump upon platforms in XNA? Th platforms are represented by a list of positions like Public platformList As List(Of Vector2)

This is the collision detection under update()

        Dim mainSpriteRect As Rectangle = New Rectangle(CInt(mainSprite.Position.X), CInt(mainSprite.Position.Y), mainSprite.texture.Width, mainSprite.texture.Height)
         'a node is simply a class with the texture and position'
        For Each _node As Node In _gameMap.nodeList
            Dim blockRect As Rectangle = New Rectangle(CInt(_node.Position.X), CInt(_node.Position.Y), _BlocksTexture.Width, _BlocksTexture.Height)


            If mainSpriteRect.Intersects(blockRect) Then
                'what should I do here? For example velocity and position?'
            End If

            If (_node.Position.Y > 800) Then
                nodeList.Remove(_node)
            End If

        Next

© Game Development or respective owner

Related posts about XNA

Related posts about sprites