Game Maker

Test Variable

281pages on
this wiki
Add New Page
Talk0 Share
Test variable window

The Test Variable action can be used to check if a variable has a certain value, or a value greater or lower than that value.

Public Class Form1

   Public Sub New()
       ' This call is required by the Windows Form Designer.
       ' Add any initialization after the InitializeComponent() call.
   End Sub
   Private Sub Finish_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs)
       'Show a congratulatory massagebox, then close the form.
       MessageBox.Show("Well Done")
   End Sub
   Private Sub MoveToStart()
       Dim StartingPoint = Panel1.Location()
       StartingPoint.Offset(10, 10)
       Cursor.Position = PointToScreen(StartingPoint)
   End Sub
   Private Sub Wall_MouseEnter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.MouseEnter, Panel1.MouseEnter, Label9.MouseEnter, Label8.MouseEnter, Label7.MouseEnter, Label63.MouseEnter, Label62.MouseEnter, Label61.MouseEnter, Label60.MouseEnter, Label6.MouseEnter, Label59.MouseEnter, Label58.MouseEnter, Label57.MouseEnter, Label56.MouseEnter, Label55.MouseEnter, Label54.MouseEnter, Label53.MouseEnter, Label52.MouseEnter, Label51.MouseEnter, Label50.MouseEnter, Label5.MouseEnter, Label49.MouseEnter, Label48.MouseEnter, Label47.MouseEnter, Label46.MouseEnter, Label45.MouseEnter, Label40.MouseEnter, Label4.MouseEnter, Label38.MouseEnter, Label37.MouseEnter, Label36.MouseEnter, Label34.MouseEnter, Label33.MouseEnter, Label32.MouseEnter, Label31.MouseEnter, Label30.MouseEnter, Label3.MouseEnter, Label29.MouseEnter, Label28.MouseEnter, Label27.MouseEnter, Label26.MouseEnter, Label25.MouseEnter, Label24.MouseEnter, Label23.MouseEnter, Label22.MouseEnter, Label21.MouseEnter, Label20.MouseEnter, Label2.MouseEnter, Label19.MouseEnter, Label18.MouseEnter, Label17.MouseEnter, Label16.MouseEnter, Label15.MouseEnter, Label14.MouseEnter, Label13.MouseEnter, Label12.MouseEnter, Label11.MouseEnter, Label10.MouseEnter, 
   End Sub

End Class


Example 1Edit

You want to move to another level when the player has reached a score larger than 500. Before changing the level, do a Test Variable with:

variable: score

value: 500

operation: larger than

leave NOT unchecked.

Now the level would only change if the score is large enough.

Example 2Edit

In a platformer game, you would not want the player to be able to jump unless they are standing on the ground. So before you set the speed that makes them jump, you do a Test Variable with these parameters:

variable: place_meeting(x,y+1,obj_floor)

value: true

operation: equal to

leave NOT unchecked.

The code place_meeting(x,y+1,obj_floor) is used to check for whether a collision with obj_floor would occur one pixel below the player. This effectively checks for whether the player is on the ground.

See alsoEdit

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Also on Fandom

Random Wiki