Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Tower Defence Grid Snap Help

Author
Message
BlackChaos
16
Years of Service
User Offline
Joined: 2nd May 2010
Location: London
Posted: 12th Dec 2011 13:40
Hey guys!

How can I change the code below so that the cube object snaps to the matrix(like grid points).

Any help would be apreciated.



Check out my website -> Ameadus Project <- Free Project files, Examples and Over 2,000 textures
Bulsatar
15
Years of Service
User Offline
Joined: 19th Apr 2011
Location:
Posted: 12th Dec 2011 15:24
I am not seeing any arrays or any kind of structure that lays out your grid. I don't know "the best" way, but off the top of my head I would suggest:
Create a RECT structure:

Create an array that defines the playing board:

Check for which gameboard squares collide with the playing piece
Refine check for which square is being overlapped most by playing piece.
Set playing piece Rect to that gameboard Rect that overlaps most when mouse button is released.

Hope that helps
MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 13th Dec 2011 06:35
Pretty much the above or a DATA grid from what I have seen before... sorry I can not point you in the right direction at the moment as on phone... but look into DATA command as well.

BlackChaos
16
Years of Service
User Offline
Joined: 2nd May 2010
Location: London
Posted: 14th Dec 2011 02:41
Thanks guys This helped

Check out my website -> Ameadus Project <- Free Project files, Examples and Over 2,000 textures

Login to post a reply

Server time is: 2026-07-09 15:47:17
Your offset time is: 2026-07-09 15:47:17