Topic:   Scripting Command Help   (Read 43170 times)


0 Members and 3 Guests are viewing this topic.

Tireas Dragon


  • GMG Extraordinaire

  • ***


  • Posts: 1626

  • Trying to recover from my shattered screen.
Re: Scripting Command Help
« Reply #30 on: May 31, 2008, 10:04:26 AM »
Interesting I didn't even realize they were all in the same script.
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.

Tireas Dragon


  • GMG Extraordinaire

  • ***


  • Posts: 1626

  • Trying to recover from my shattered screen.
Re: Scripting Command Help
« Reply #31 on: May 31, 2008, 10:08:38 AM »
I just did that and it does run smoother. When you are not pressing any buttons.

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.

Al Staffieri


  • GMG-er

  • **

  • no avatar

  • Posts: 452

  • I love GameMaker
Re: Scripting Command Help
« Reply #32 on: May 31, 2008, 10:15:01 AM »
Try this code. Turn on the Loop Script and replace the card script with this code. It uses the loop script option to keep running the script instead of using a timer. There's no timer in this.

Code: [Select]
IF loopscript = 0 THEN
  
  LET movex = -300
  LET money = -300
  SPRITE 1 -300 -300 $star$$
  SPRITE 3 285 130 $ship$$
  ON KEYDOWN
    IF keydown$ = "UPARROW" THEN
      SPRITE -3 285 130 $shipup$$
      IF moveyspeed < 40 THEN LET moveyspeed = moveyspeed + 3
    END IF
    IF keydown$ = "DOWNARROW" THEN
      SPRITE -3 285 130 $shipdown$$
      IF moveyspeed > -40 THEN LET moveyspeed = moveyspeed - 3
    END IF
    IF keydown$ = "LEFTARROW" THEN
      SPRITE -3 285 130 $shipleft$$
      IF movexspeed < 40 THEN LET movexspeed = movexspeed + 3
    END IF
    IF keydown$ = "RIGHTARROW" THEN
      SPRITE -3 285 130 $shipright$$
      IF movexspeed > -40 THEN LET movexspeed = movexspeed - 3
    END IF
    IF keydown$ = "w" THEN
      movexspeed = 0
      moveyspeed = 0
    END IF
  END KEYDOWN
  
ELSE
  
  LET movex = movex + movexspeed
  LET movey = moveY + moveyspeed
  IF movex < -360 THEN
    movex = movex + 300
  END IF
  IF movey < -360 THEN
    movey = movey + 300
  END IF
  IF movex > -41 THEN
    movex = movex - 300
  END IF
  IF movey > -41 THEN
    movey = movey - 300
  END IF
  SPRITE 1 movex movey
  
END IF

Tireas Dragon


  • GMG Extraordinaire

  • ***


  • Posts: 1626

  • Trying to recover from my shattered screen.
Re: Scripting Command Help
« Reply #33 on: May 31, 2008, 04:42:21 PM »
Wow that is so much smoother. Thanks Al

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.

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: Scripting Command Help
« Reply #34 on: May 31, 2008, 09:48:41 PM »
Ah :) I can't wait to try it. Though I'm on a very old computer, so I will take a look at it later.

Thanks Al.

-Gandolf

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: Scripting Command Help
« Reply #35 on: June 30, 2008, 08:12:04 PM »
Hey, TD, do you still have the infinite space script?

If you do, could you post it?


Thanks,
-Gandolf

Tireas Dragon


  • GMG Extraordinaire

  • ***


  • Posts: 1626

  • Trying to recover from my shattered screen.
Re: Scripting Command Help
« Reply #36 on: June 30, 2008, 09:47:21 PM »
Oh thats easy I just made it so if the sprite is over enough it moves 300 pixels in the opposite direction.
Code: [Select]
LET movex = -300
LET moveY = -300
SPRITE 1 -300 -300 $star$$
SPRITE 3 285 130 $ship$$
ON KEYDOWN
IF keydown$ = "UPARROW" THEN
  SPRITE -3 285 130 $shipup$$
  IF moveyspeed < 40 THEN LET moveyspeed = moveyspeed + 3
END IF
IF keydown$ = "DOWNARROW" THEN
  SPRITE -3 285 130 $shipdown$$
  IF moveyspeed > -40 THEN LET moveyspeed = moveyspeed - 3
END IF
IF keydown$ = "LEFTARROW" THEN
  SPRITE -3 285 130 $shipleft$$
  IF movexspeed < 40 THEN LET movexspeed = movexspeed + 3
END IF
IF keydown$ = "RIGHTARROW" THEN
  SPRITE -3 285 130 $shipright$$
  IF movexspeed > -40 THEN LET movexspeed = movexspeed - 3
END IF
IF keydown$ = "W" THEN
  movexspeed = 0
  moveyspeed = 0
END IF
keydown$ = ""
ON TIMER 2
LET movex = movex + movexspeed
LET movey = movey + moveyspeed
IF movex < -360 THEN movex = movex + 300
IF movey < -360 THEN movey = movey + 300
IF movex > -41 THEN movex = movex - 300
IF movey > -41 THEN movey = movey - 300
SPRITE 1 movex movey
END TIMER
END KEYDOWN
IF y = 0 THEN
y = 1
END IF
« Last Edit: June 30, 2008, 09:50:48 PM by Tireas_Dragon »
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.