View Single Post
Old 08-03-2017, 05:38 AM
TheRealTinTin's Avatar
TheRealTinTin TheRealTinTin is offline
Junior Contributor
Join Date: Nov 2008
Location: Glasgow, UK
Posts: 383

As Goggy has said, you need to check where the boat is in comparison to all other objects. Given the simplicity of your map, you could simply create a 2D array that stores whether the relevant pixel is water or an object.

Imagine your image is 600x600. In the top corner, you have 1 square object that is 150x150. You would create an array
Dim Map(599, 599) As Int
Then define the object:
Dim x As Int
Dim y As Int

For x = 0 To 149
    For y = 0 To 149
        Map(x, y) = 1
    Next y
Next x
Now, when you move your boat you can use it's .Top, .Left, .Width and .Height properties to determine if it's hit anything by checking those co-ordinates against your array. If any of the array elements where the boat is are 1, it has hit something.
Artificial Intelligence is no match for natural stupidity
Reply With Quote