Topic:   GM Grid Systems   (Read 10360 times)


0 Members and 1 Guest are viewing this topic.

Mystor


  • GMG-er

  • **


  • Posts: 696

  • I am the myst that consumes us all.
GM Grid Systems
« on: March 04, 2008, 02:11:10 PM »
This is my idea:

Because of the number of GM Grid Systems that silver has written, I think that we should have a place to put all of the code.

People can post the different Grid System's code (Preferabally along with a Grid Nav example)

Please refrain idle conversation :P

(This is because I can't find the code for grid nav v5 etc...)

Mist
"I'll lie to him."
"And if that doesn't work?"
"Then I'll tell the truth. We're allowed to do that, in emergencies. We can't plan for everything, you know."
   -Colonel Graff, Ender&

Silverwind


  • ^ This guy is amazing.

  • ****


  • Posts: 2805

  • For the glory of my maker
Re: GM Grid Systems
« Reply #1 on: March 04, 2008, 03:26:51 PM »
Wow, I was just planning to do that this morning, you practically used the very words I did! :D Great minds think alike.

I'm gonna update Roguesoft's download link for the Grid Nav Example when I get the V6 example done. I think it's V4 atm. ::)
I survived the spammage of 2007

Mystor


  • GMG-er

  • **


  • Posts: 696

  • I am the myst that consumes us all.
Re: GM Grid Systems
« Reply #2 on: March 04, 2008, 03:28:26 PM »
Actually it is V5, the original V5 that is :p

As in the one without walls and portals, instead using other stuff :-/

The one with movecompleted etc...

Whatever, it is outdated :P

Mist
"I'll lie to him."
"And if that doesn't work?"
"Then I'll tell the truth. We're allowed to do that, in emergencies. We can't plan for everything, you know."
   -Colonel Graff, Ender&

Silverwind


  • ^ This guy is amazing.

  • ****


  • Posts: 2805

  • For the glory of my maker
Re: GM Grid Systems
« Reply #3 on: March 04, 2008, 03:41:13 PM »
Ah, that's slightly better at least. Here's the updated V6 template:
Code: [Select]
PICT CurrentCard
gridlayout$ = ""
area$ = "surface"
northcard = 0
southcard = 0
eastcard = 0
westcard = 0
playerY = gridY * 44
playerY = playerY - 39
playerX = gridX * 44
playerX = playerX - 39
moveY = gridY
moveX = gridX

SPRITE 15 playerX playerY $playersprite$$

'----PLAYER CODE--------------------------------------------------------------------------------
ON KEYDOWN
newtile$ = "empty"
IF keydown$ = "UPARROW" THEN moveY = gridY - 1
IF keydown$ = "DOWNARROW" THEN moveY = gridY + 1
IF keydown$ = "LEFTARROW" THEN moveX = gridX - 1
IF keydown$ = "RIGHTARROW" THEN moveX = gridX + 1
'----GRID CODE-----------------------------------------------------------------------------------
moveXY = 0
moveXY = 7 * moveY
moveXY = moveXY - 7
moveXY = moveXY + moveX
newtile$ = MID$ gridlayout$ moveXY 1
IF newtile$ = "0" THEN newtile$ = "empty"
IF newtile$ = "1" THEN newtile$ = "wall"
IF newtile$ = "2" THEN newtile$ = "portal 1"
'---/GRID CODE-----------------------------------------------------------------------------------
IF moveY < 1 THEN
 Â gridY = 7
 Â GOTOCARD northcard
END IF
IF moveY > 7 THEN
 Â gridY = 1
 Â GOTOCARD southcard
END IF
IF moveX > 7 THEN
 Â gridX = 1
 Â GOTOCARD eastcard
END IF
IF moveX < 1 THEN
 Â gridX = 7
 Â GOTOCARD westcard
END IF
IF newtile$ = "portal 1" THEN
 Â gridY = 0
 Â gridX = 0
 Â GOTOCARD 0
END IF
IF newtile$ = "empty" THEN
 Â IF keydown$ = "UPARROW" THEN playerY = playerY - 44
 Â IF keydown$ = "DOWNARROW" THEN playerY = playerY + 44
 Â IF keydown$ = "LEFTARROW" THEN playerX = playerX - 44
 Â IF keydown$ = "RIGHTARROW" THEN playerX = playerX + 44
 Â gridY = moveY
 Â gridX = moveX
END IF
IF newtile$ = "wall" THEN
 Â moveY = gridY
 Â moveX = gridX
END IF

SPRITE 15 playerX playerY
END KEYDOWN
'---/PLAYER CODE--------------------------------------------------------------------------------
« Last Edit: April 30, 2008, 03:25:15 AM by Silverwind »
I survived the spammage of 2007

Mystor


  • GMG-er

  • **


  • Posts: 696

  • I am the myst that consumes us all.
Re: GM Grid Systems
« Reply #4 on: March 04, 2008, 03:56:48 PM »
Ok...

Based off of the current V5 Grid Nav example, I have made somthing work like smart nav.

Code: [Select]
SPRITE 10 playerX playerY player1.gif
CLEAR TEXT
PRINT playerX: $playerX$
PRINT playerY: $playerY$
PRINT
PRINT gridX: $gridX$
PRINT gridY: $gridY$
PRINT
PRINT moveX: $moveX$
PRINT moveY: $moveY$
PRINT
PRINT
PRINT movesuccessful: $movesuccessful$
PRINT keydown$: $keydown$$

ON KEYDOWN

directionkeypressed = 0
movesuccessful = 0
IF keydown$ = "UPARROW" THEN moveY = gridY - 1
IF keydown$ = "DOWNARROW" THEN moveY = gridY + 1
IF keydown$ = "LEFTARROW" THEN moveX = gridX - 1
IF keydown$ = "RIGHTARROW" THEN moveX = gridX + 1
IF keydown$ CONTAINS "ARROW" THEN directionkeypressed = 1
IF moveY < 1 THEN movesuccessful = 1
IF moveY > 7 THEN movesuccessful = 1
IF moveX < 1 THEN movesuccessful = 1
IF moveX > 7 THEN movesuccessful = 1
'----GRID CODE-----------------------------------------------------------------------------------

walls$ = " 54 25 46 17 67 77"
portals$ = ""
mypos = 10 * moveX
mypos = mypos + moveY
mpos$ = STR$ mypos
IF walls$ CONTAINS mpos$ THEN
  movesuccessful = 1
END IF
IF portals$ CONTAINS mpos$ THEN
  '(portal code)
END IF
'---/GRID CODE-----------------------------------------------------------------------------------
IF movesuccessful = 0 THEN
  IF keydown$ = "UPARROW" THEN playerY = playerY - 44
  IF keydown$ = "DOWNARROW" THEN playerY = playerY + 44
  IF keydown$ = "LEFTARROW" THEN playerX = playerX - 44
  IF keydown$ = "RIGHTARROW" THEN playerX = playerX + 44
  gridY = moveY
  gridX = moveX
  SPRITE 10 playerX playerY
END IF
IF movesuccessful = 1 THEN
  moveY = gridY
  moveX = gridX
END IF

CLEAR TEXT
PRINT playerX: $playerX$
PRINT playerY: $playerY$
PRINT
PRINT gridX: $gridX$
PRINT gridY: $gridY$
PRINT
PRINT moveX: $moveX$
PRINT moveY: $moveY$
PRINT
PRINT
PRINT movesuccessful: $movesuccessful$
PRINT keydown$: $keydown$$

END KEYDOWN

BTW, I know that the walls$ string has a space at the beginning, CONTAINS doesn't like the first character :(

Mist
"I'll lie to him."
"And if that doesn't work?"
"Then I'll tell the truth. We're allowed to do that, in emergencies. We can't plan for everything, you know."
   -Colonel Graff, Ender&

alias


  • Guest
Re: GM Grid Systems
« Reply #5 on: April 09, 2008, 06:04:41 AM »
I made an old grid system, i shall upload it someplace then put the link here...

EDIT:
LINK: http://myfreefilehosting.com/f/dcca1a19be_0.17MB bad link use this one
http://www.filefactory.com/file/6042cb
« Last Edit: April 09, 2008, 06:56:26 PM by alias »

Al Staffieri


  • GMG-er

  • **

  • no avatar

  • Posts: 452

  • I love GameMaker
Re: GM Grid Systems
« Reply #6 on: April 10, 2008, 10:43:33 AM »
Quote
I know that the walls$ string has a space at the beginning, CONTAINS doesn't like the first character

It's a problem with STR$.  When you convert a number to a string with STR$ it puts a space in front of the number unless it's a negative number.

x = 10
a$ = STR$ x
' the above makes a$ = " 10"

x = -10
a$ = STR$ x
' the above makes a$ = "-10"

Mystor


  • GMG-er

  • **


  • Posts: 696

  • I am the myst that consumes us all.
Re: GM Grid Systems
« Reply #7 on: April 10, 2008, 01:55:50 PM »
I see!
Cool :)

Mist
"I'll lie to him."
"And if that doesn't work?"
"Then I'll tell the truth. We're allowed to do that, in emergencies. We can't plan for everything, you know."
   -Colonel Graff, Ender&

Silverwind


  • ^ This guy is amazing.

  • ****


  • Posts: 2805

  • For the glory of my maker
Re: GM Grid Systems
« Reply #8 on: April 30, 2008, 03:26:56 AM »
I've updated the V6 template to include TD's awesome upgrade. Now V6 is even more unstoppably unstoppable! :D
I survived the spammage of 2007

Tireas Dragon


  • GMG Extraordinaire

  • ***


  • Posts: 1626

  • Trying to recover from my shattered screen.
Re: GM Grid Systems
« Reply #9 on: April 30, 2008, 10:22:20 AM »
I still don't understand v5  ???  Well since its primitive compared to to the new v6 I guess it doesn't matter   :)
I must be dreaming (wake up me wake up) How could this have happened. Tireas' cry when he found his computer fallen over in his chair with it's screen shattered.