Topic:   Can someone convert this to Gm?   (Read 19418 times)


0 Members and 1 Guest are viewing this topic.

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Can someone convert this to Gm?
« on: May 13, 2008, 07:16:54 AM »
Just wondering, but could this script be accurately converted to GM? (I am so use to SilverCreater that I have very little experience with GM scripting)

***This is when the Card opens***

Code: [Select]
CREATESPRITE background, "background"
MOVESPRITE background, SPRITEX(2) - 500, SPRITEY(2) - 500, true
CREATESPRITE topmountainblock, "topmountainblock"
MOVESPRITE topmountainblock, 0, SPRITEY(2) - 335, true
CREATESPRITE bottommountainblock, "topmountainblock"
MOVESPRITE bottommountainblock, 0, SPRITEY(2)-550, true
CREATESPRITE leftmountainblock, "sidemountainblock"
MOVESPRITE leftmountainblock, SPRITEY(2) -330, 0, true
FOR x=1 to 10
   IF spritevalid(x)=1 then
      SHOWSPRITE x,1
   END IF
NEXT
MOVESPRITE man, 290, 150, 1
MOVESPRITE bar, 282, 187, 1
CREATESPRITE bar2, "Bar", 1
MOVESPRITE bar2, 282, 187
LET monsterattack = 1
CREATESPRITE background, "background"
MOVESPRITE background, SPRITEX(2) - 500, SPRITEY(2) - 500, true
CREATESPRITE man, "mandown"
MOVESPRITE man, 290, 150, true
SCALESPRITE man, 100

ON TIMER 120
   LET npcwalk = Random(40)
   LET npcdir = RANDOM(4)
   SELECT CASE npcdir
   CASE 1
      LET npcdir$ = "up"
      RECREATESPRITE fnpc, "manup", 1
      PUSHSPRITE fnpc, 0, -npcwalk
   CASE 2
      LET npcdir$ = "left"
      RECREATESPRITE fnpc, "manleft", 1
      PUSHSPRITE fnpc, -npcwalk, 0
   CASE 3
      LET npcdir$ = "down"
      RECREATESPRITE fnpc, "mandown", 1
      PUSHSPRITE fnpc, 0, npcwalk
   CASE 4
      LET npcdir$ = "right"
      RECREATESPRITE fnpc, "manright", 1
      PUSHSPRITE fnpc, npcwalk, 0
   END SELECT
END TIMER
IF text2 = 0 then
   LET text2 = 1
END IF


***This is when someone presses a Key***

Code: [Select]
LET walk=walk+1
IF walk=6 Then
   LET walk=1
END IF

LET pushX=0
LET pushY=0

SELECT CASE key$
CASE uparrow$
   LET dir$="up"
   LET pushy=10
CASE downarrow$
   LET dir$="down"
   LET pushy=-10
CASE leftarrow$
   LET dir$="left"
   LET pushx=10
CASE rightarrow$
   LET dir$="right"
   LET pushx=-10
END SELECT

IF SHIFTKEY = TRUE THEN
   LET pushx=pushx*3
   LET pushy=pushy*3
END IF
SELECT CASE dir$
CASE "up"
   IF walk<4 then
      RECREATESPRITE man, "manup1", 1
   ELSE
      RECREATESPRITE man, "manup", 1
   END IF
CASE "down"
   IF walk<4 then
      RECREATESPRITE man, "mandown1", 1
   ELSE
      RECREATESPRITE man, "mandown", 1
   END IF
CASE "right"
   IF walk<4 then
      RECREATESPRITE man, "manright1", 1
   ELSE
      RECREATESPRITE man, "manright", 1
   END IF
CASE "left"
   IF walk<4 then
      RECREATESPRITE man, "manleft1", 1
   ELSE
      RECREATESPRITE man, "manleft", 1
   END IF
END SELECT

FOR x=1 to 16
   IF spritevalid(x)=1 then
      PUSHSPRITE x, pushX, pushY, 1               //process the movement
   END IF
NEXT

LET move=1
FOR x=2 to 4
   IF spritevalid(x)=1 then
      IF spritestouching(man, x)=1 then
         LET move=0                                 //if man is touching obstacle let move=0
      END IF
   END IF
NEXT
IF spritestouching(man, topmountainblock)=1 then
   LET move = 0
END IF
IF spritestouching(man, bottommountainblock)=1 then
   LET move = 0
END IF

IF spritestouching(man, wildgrass)=1 then
   IF monsterattack = 1 then
      LET x=random(10)                                         //chance of enemy encounter
      IF x=1 then
         LOAD_ENEMY
         LET monsterattack=2
      END IF
   END IF
   IF monsterattack = 2 then
      LET x=random(20)                                         //chance of enemy encounter
      IF x=2 then
         LOAD_ENEMY
         LET monsterattack=1
      END IF
   END IF
END IF
IF spritestouching(man, inndoor)=1 then
   GOTOCARD 5
END IF
IF spritestouching(man, blacksmithdoor)=1 then
   GOTOCARD 6
END IF
IF spritestouching(man, potiondoor)=1 then
   GOTOCARD 7
END IF

IF move=0 then                  //if move=0 then push everything back
   IF pushX>0 then
      LET pushX=-ABS(pushX)
   ELSE
      LET pushX=ABS(pushX)
   END IF
   IF pushY>0 then
      LET pushY=-ABS(pushY)
   ELSE
      LET pushY=ABS(pushY)
   END IF
   FOR x=1 to 16
      IF spritevalid(x)=1 then
         PUSHSPRITE x, pushX, pushY, 1
      END IF
   NEXT
END IF

SHOWSPRITE man

LET backgroundX = SPRITEX("background")
LET backgroundY = SPRITEY("background")


***This is when the card closes***

Code: [Select]
FOR x=1 to 9
   IF spritevalid(x)=1 then
      HIDESPRITE x,1
   END IF
NEXT

stoptimer


This is basicly the entire code for walking. It actually runs pretty smooth. How well can this be converted?

Thanks,

-Gandolf

Silverwind


  • ^ This guy is amazing.

  • ****


  • Posts: 2805

  • For the glory of my maker
Re: Can someone convert this to Gm?
« Reply #1 on: May 13, 2008, 08:57:57 AM »
If you show me the game I might be able to do it. I'm still kinda hazy at SC's sprite commands.
I survived the spammage of 2007

EqwanoX


  • Administrator

  • GMG Extraordinaire

  • *****


  • Posts: 1180
Re: Can someone convert this to Gm?
« Reply #2 on: May 13, 2008, 03:50:25 PM »
if your used to SC then WHY do you want to convert it to GM?  if  you plan on using GM then why dont you learn to convert it, sinse you have to learn it sooner or later
« Last Edit: May 13, 2008, 03:52:58 PM by EqwanoX »

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: Can someone convert this to Gm?
« Reply #3 on: May 13, 2008, 05:24:21 PM »
Its for SwashBuckler  :). GM group project. I just don't want to waste tons of time creating crappy coding that won't work. If I take too long, SwashBuckler is gonna be abandoned. So if anyone could help, this would be greatly appreciated. If not, I will start myself, might never finish though.

-Gandolf

Silverwind


  • ^ This guy is amazing.

  • ****


  • Posts: 2805

  • For the glory of my maker
Re: Can someone convert this to Gm?
« Reply #4 on: May 14, 2008, 02:47:16 AM »
Quote
If you show me the game I might be able to do it. I'm still kinda hazy at SC's sprite commands.
:)
I survived the spammage of 2007

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: Can someone convert this to Gm?
« Reply #5 on: May 14, 2008, 06:38:08 AM »
Thanks  ;)

I can probably help you with the sprite commands.

-Gandolf

Silverwind


  • ^ This guy is amazing.

  • ****


  • Posts: 2805

  • For the glory of my maker
Re: Can someone convert this to Gm?
« Reply #6 on: May 14, 2008, 07:52:07 AM »
As I said though, if you showed me the actual SC game with the code in it, I'd find the conversion allot easier. (as then I could see what I'd be trying to make happen) Do you have a link to the game?
I survived the spammage of 2007

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: Can someone convert this to Gm?
« Reply #7 on: May 14, 2008, 05:37:37 PM »
Sure  :)

Link to SC Game Source: http://web.mac.com/avisaria/athora.scproj

-Gandolf