Forum Replies Created
-
AuthorPosts
-
There are named constants for some colors. You can also create create your own colors. eg
[/crayon]Monkey12[crayon-5cb9d7c65670c208670587 inline="true" ]Local myColor1 := New Color(0.2, 0.1, 0.6, 1.0)Local myColor2 := Color.FromARGB($FFA06620)The docs have more information…
Bugs, I’d say. I’m seeing similar results from my own terrain generator (quite different than yours).
But remember Mojo3d is still a WIP Alpha, so much of it is not “production” ready yet.
The mazes it makes are not quite complete- they have numerous “dead” ends and there is no single complete path from one side to the other- in other words, there is not one entrance and one exit.
The code generates “perfect” mazes, meaning every coordinate is reachable from every other coordinate within the maze. There are many types of mazes. See here:
http://www.astrolog.org/labyrnth/algrithm.htm
A shame there is only 10 examples of code and over 1800 posts looking for help with Monkey 2.
The “Monkey 2 Code Library” forum is only a week old. More examples will be posted over time. Personally I have more examples to post when I tidy up my code, but at the moment I’m too busy working on other projects.
@Mark Sibly:
Yes, nice idea, and probably the way it “should” be done.
Possibly a bit ‘high level’ for monkey2? Or not?
Not at all: extra functionality is always welcome. But don’t spread yourself too thin: you have enough to do already!
This is the way I’m currently doing it:
1. Enumerate the in-game commands that are assignable to keys:
[/crayon]Monkey123456789101112131415161718[crayon-5cb9d7c65f8ff102783222 inline="true" ]Enum CommandExitGame = 0MoveForwardMoveBackStrafeLeftStrafeRightJumpRaiseStanceLowerStanceSpeedFastSpeedSlowInteractLengthEnd2. Store and initialise the keybindings in a global Key array:
[/crayon]Monkey1234567891011121314151617[crayon-5cb9d7c65f904498806274 inline="true" ]Global KeyBindings := New Key[Command.Length]Function InitBindings()KeyBindings[Command.ExitGame] = Key.EscapeKeyBindings[Command.MoveForward] = Key.W | Key.RawKeyBindings[Command.MoveBack] = Key.S | Key.RawKeyBindings[Command.StrafeLeft] = Key.A | Key.RawKeyBindings[Command.StrafeRight] = Key.D | Key.RawKeyBindings[Command.Interact] = Key.E | Key.RawKeyBindings[Command.SpeedFast] = Key.LeftShift | Key.RawKeyBindings[Command.SpeedSlow] = Key.LeftControl | Key.RawEnd3. Check for the bounded keys during the game’s update call:
[/crayon]Monkey12345678910111213141516171819202122232425262728[crayon-5cb9d7c65f909464053825 inline="true" ]Method OnUpdate:Void()'...Local velocity := 0.2If Keyboard.KeyDown(KeyBindings[Command.SpeedFast])velocity = 1.0Elseif Keyboard.KeyDown(KeyBindings[Command.SpeedSlow])velocity = 0.05EndifIf Keyboard.KeyDown(KeyBindings[Command.ExitGame])App.Terminate()Elseif Keyboard.KeyDown(KeyBindings[Command.MoveForward])_camera.MoveZ(velocity)Elseif Keyboard.KeyDown(KeyBindings[Command.MoveBack])_camera.MoveZ(-velocity)Elseif Keyboard.KeyDown(KeyBindings[Command.StrafeLeft])_camera.MoveX(-velocity)Elseif Keyboard.KeyDown(KeyBindings[Command.StrafeRight])_camera.MoveX(velocity)Endif'..._mouseLook.Update()EndThe hope is it will make it easy to add a key-rebinding screen (as you’re wanting to do)…
I’ll probably encapsulate the behaviour in a class but the fundamentals are there…
Good idea, @peterigz.
And if the Blitzbasic.com archives are inaccessible you might be able to find them through the “Wayback Machine”
There are many language similarities but also some differences that could cause confusion.
Most of BlitzMax’s language concepts have direct Monkey2 equivalents (eg Functions, Objects, Methods, Globals, Locals, Interfaces, Pointers, Modules, Public, Private, etc) but Monkey2 also has additional concepts (eg Interfaces, Virtual Methods, Abstract Classes, Enumerated types, Operator Overloading, Fibres, Structures, Lambda Functions, etc).
You can structure your own code to not use those additional language features, and therefore convert standard object-oriented BlitzMax code quite easily to equivalent Monkey2 code. However, some of Monkey2’s modules make extensive use of the additional language features and require at least a passing understanding of how they work.
A good example is MojoX, Monkey 2’s GUI module. It is quite different than MaxGUI.
So, yes, you can use much of what you learned in BlitzMax – you won’t have to start again. But you will need to build upon that knowledge…
@Mark Sibly:
…code library forum added
Thanks. I just added a first snippet.
Adjusting the “height” and “width” properties of “crayon” seems to work to simulate a “code box”. (Thanks @nerobot for the suggestion: http://monkeycoder.co.nz/forums/topic/perlin-noise/page/2/)
“Let’s get this party started…”
PS: Any chance of a “Monkey 2 Code” forum that we can post our code snippets into?
You could maybe do something like this:
[/crayon]Monkey1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586[crayon-5cb9d7c66e27c918778409 inline="true" ]#Import "<std>"Using std..Function Main()Local recList := New RecordList()recList.Add(New Record("Dude"))recList.Add(New Record("Jane Doe"))recList.Add(New Record("@Dude"))recList.Add(New Record("+Jane Doe"))recList.Add(New Record("+Dude"))recList.Add(New Record("@Jane Doe"))Print "~nUnsorted~n-----------"recList.PrintAll()recList.Sort(RecordList.SortByName)Print "~nSorted (First pass) ~n-----------"recList.PrintAll()recList.Sort(RecordList.SortByCharTweak)Print "~nSorted (Second pass) ~n-----------"recList.PrintAll()EndClass RecordList Extends List<Record>PublicMethod New()Super.New()EndMethod PrintAll()For Local rec := Eachin SelfPrint rec.ToString()NextEndFunction SortByName:Int(lhs:Record, rhs:Record)Return lhs.Name <=> rhs.NameEndFunction SortByCharTweak:Int(lhs:Record, rhs:Record)If (lhs.Name.Length <= 0) Or (rhs.Name.Length <= 0) Then Return 0If lhs.Name[0] = "@"[0] Then Return lhs.Name>rhs.NameIf rhs.Name[0] = "@"[0] Then Return rhs.Name>lhs.NameIf lhs.Name[0] = "+"[0] Then Return lhs.Name>rhs.NameIf rhs.Name[0] = "+"[0] Then Return rhs.Name>lhs.NameReturn 0EndEndClass RecordPublicMethod New(name:String)Name = nameEndProperty Name:String()Return _nameSetter (value:String)_name = valueEndMethod ToString:String()Return NameEndPrivateField _name:StringEnd@pakz: We have very similar objectives / plans!
In addition to procedurally generating level layout, I’m trying to decide if it’s worth generating models and materials in code too. Probably not…
What did it cost before?
TBH, from a consumer’s perspective I can only see negatives: Steam is already flooded with “crap”; if the entry barrier is even lower it’s going to get worse.
I was going to ask the same question…
Functional: https://en.wikipedia.org/wiki/Functional_programming
Procedural: https://en.wikipedia.org/wiki/Procedural_programmingFunctional programming, as in lisp, clojure, etc
Procedural programming, as in old style basic, pascal, c, etc.There are different GUI implementation strategies for both styles, though IIRC it’s rather difficult to do in a purely functional manner.
Ah, I see. Then yes, you’ll need something lower level, probably coded in C/C++. Good luck.
* Hide the “actual” mouse cursor. Draw a “sprite” mouse cursor instead.
* Read your gamepad input coordinates.
* Translate the coordinates to a screen location vector.
* Draw the mouse cursor sprite at the vector.
* Trigger an EventType.MouseMove event, including the vector.
* Handle the event in the OnMouseEvent method.Easy peasy?!
Or I still misunderstand your objectives… Forgive me if that’s the case.
-
AuthorPosts