Make Sprite Jump Upon a Platform
- by Geore Shg
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