Artificial intelligence/templates/examples/rts/rpg/strategy ect. in MonkeyX/CerberusX language. You can download the free version of MonkeyX from itch.io or Cerberus-x.com The Flash applets will stop working in around 2020.
Wednesday, December 31, 2014
Tuesday, December 30, 2014
Monday, December 29, 2014
Saturday, December 27, 2014
Friday, December 26, 2014
Thursday, December 25, 2014
Wednesday, December 24, 2014
Monkey getting started - simple Rectangle Overlap example code
Function Main:Int() If rectsoverlap(10,10,10,10,12,12,10,10) = False Then Print("No Collision") Else Print("Collision") End If Return 0 End Function Function rectsoverlap:Bool(x1:Int, y1:Int, w1:Int, h1:Int, x2:Int, y2:Int, w2:Int, h2:Int) If x1 >= (x2 + w2) Or (x1 + w1) <= x2 Then Return False If y1 >= (y2 + h2) Or (y1 + h1) <= y2 Then Return False Return True End
Monkey getting started - Printing Constant variables example code
I made this example while watching the youtube tutorials for monkey.
This is the outputted result :
10 1.1 hello
This is the code :
Const con1:Int = 10
Const con2:Float = 1.1
Const con3:String = "hello"
Function Main:Int()
Print(con1)
Print(con2)
Print(con3)
Return 0
End Function
Monkey getting started - Printing Global variables Example code
I am following the youtube tutorials for beginners for monkey and then I made this.
Code below ( Copy and paste it into notepad and then copy paste it into the mokey editor and run it.
This is the outputted result. As you can see the floating value is not what you might of expected,
100 1.1000000238418579 Hello
Global val1:Int = 100
Global val2:Float = 1.1
Global txt1:String = "Hello"
Function Main:Int()
Print(val1)
Print(val2)
Print(txt1)
Return 0
End Function
Monkey getting started - Adding up value through function example code
I started doing some programming in Monkey. I have not programmed in it a lot before so I need to learn a lot. There is not a lot of example code available afaik so I will put my own code on a blog so I can let others learn from it and so that I can get back into it when I have not done anything in it before. It is also a good way to backup code.
The code below shows a function that adds up two values. In the main function the value is printed to the debug screen. The result 20 will be shown.
afaik the code works both as compiled with html5 mode or desktop mode.
Function add:Int(val1:Int,val2:Int) Return val1+val2 End Function Function Main:Int() Print(add(10,10)) Return 0 End Function
Subscribe to:
Posts (Atom)