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.
Here some code that shows you how to return arrays from functions.
Code below:
Import mojo Global a:Int[5] Class MyGame Extends App Method OnCreate() SetUpdateRate(60) ' Fill the array with values a = filla() End Method Method OnUpdate() End Method Method OnRender() Cls(0,0,0) SetColor(255,255,255) For Local i=0 Until 5 DrawText "Value of array : a["+i+"] = "+a[i],10,i*20+100 Next End End ' Function that fill the array with values Function filla:Int[]() Local aa:Int[5] For Local i=0 Until 5 aa[i] = i Next Return aa End Function Function Main() New MyGame() End
Note: Only a member of this blog may post a comment.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.