Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Game

Game

Scheduled Pinned Locked Moved Visual Basic
graphicsgame-dev
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Andy H
    wrote on last edited by
    #1

    Can someone explain to me how I can create a program which can have 16 tiles, each with a separate picture/image, and the user can then move the tiles around to form a 4 * 4 square. Each tile can have the image rotated by 90 degrees clockwise or 180 degrees clockwise. If the tiles could automatically stick to each other when they get close, so that each tile is set to the same hight as it's neighbour that would be great. Sorry, if this sounds quite easy, but I have don't do much graphics work normally. Cheers :-D

    N D 2 Replies Last reply
    0
    • A Andy H

      Can someone explain to me how I can create a program which can have 16 tiles, each with a separate picture/image, and the user can then move the tiles around to form a 4 * 4 square. Each tile can have the image rotated by 90 degrees clockwise or 180 degrees clockwise. If the tiles could automatically stick to each other when they get close, so that each tile is set to the same hight as it's neighbour that would be great. Sorry, if this sounds quite easy, but I have don't do much graphics work normally. Cheers :-D

      N Offline
      N Offline
      Nick Seng
      wrote on last edited by
      #2

      I don't know if there's a better way, but i'd implement each tile as an object(class), with a image and rotation property, and a board object with 16 panes or groupboxes. The rest is just drag and drop. I hope that helps Notorious SMC


      Vb is as VB does

      1 Reply Last reply
      0
      • A Andy H

        Can someone explain to me how I can create a program which can have 16 tiles, each with a separate picture/image, and the user can then move the tiles around to form a 4 * 4 square. Each tile can have the image rotated by 90 degrees clockwise or 180 degrees clockwise. If the tiles could automatically stick to each other when they get close, so that each tile is set to the same hight as it's neighbour that would be great. Sorry, if this sounds quite easy, but I have don't do much graphics work normally. Cheers :-D

        D Offline
        D Offline
        David Brooks
        wrote on last edited by
        #3

        Don't know if you got your answer yet, but I came across an example in the book VI6 Unleashed. It isn't exactly the solution, but it demonstrates moving graphics around and locking them into place. I don't think there is an IP issue sharing this with you. I also don't know how to attach a file, so here is the source for the page in in line: (Graphics files obviously missing.) I hope it helps. Flags of Canada <!-- beingdragged = "" theid="" sub domousedn theid = window.event.srcElement.id ' if left(theid,4) = "text" then beingdragged = "" else beingdragged = theid end if end sub sub domousemv if window.event.X < 45 then beingdragged="" end if if window.event.Y < 34 then beingdragged="" end if if beingdragged <> "" then ' document.all(beingdragged).style.pixelLeft = window.event.x - 45 document.all(beingdragged).style.pixelTop = window.event.y - 34 call checkpos end if window.event.cancelBubble = true window.event.returnValue = false end sub sub checkpos() textname="text" & beingdragged if (document.all(beingdragged).style.pixelLeft > document.all(textname).style.pixelLeft - 10 AND _ document.all(beingdragged).style.pixelLeft < document.all(textname).style.pixelLeft + 10) _ and _ (document.all(beingdragged).style.pixelTop > document.all(textname).style.pixelTop - 10 AND _ document.all(beingdragged).style.pixelTop < document.all(textname).style.pixelTop + 10) THEN document.all(beingdragged).style.pixelLeft = document.all(textname).style.pixelLeft document.all(beingdragged).style.pixelTop = document.all(textname).style.pixelTop document.all(beingdragged).filters.alpha.opacity=50 document.all(textname).style.visibility="hidden" beingdragged="" end if end sub sub domouseup if beingdragged <> "" then ' document.all(beingdragged).style.zIndex = 0 beingdragged = "" window.event.cancelBubble = true window.event.returnValue = false end if end sub '--> <!-- sub document_onmousedown call domousedn end sub sub document_onmousemove call domousemv end sub sub document_onmouseup call domouseup end sub -->

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups