Forum Replies Created
-
AuthorPosts
-
Monkey 2 is fine, ultimately the biggest selling point will be what’s produced with it. I think a better job could be done showcasing there, wasn’t necrodancer a monkey game? Any hit game should be showcased and if possible interview them for the site, why they chose the language etc., I’m sure they’d be happy to in most cases.
Anyone watch the Johnathon Blow vids where he discusses the language he’s making? I find those really interesting, it’d be good to see something like that from Mark discussing various progress and features in Monkey 2 if he’s up for it
I think they’re a good way to drive a bit more traffic and sell it a bit more. I think I’ll probably do that a bit next year depending on where I am with projects – then when you see how crap I am it might inspire a bit more confidence eg: https://youtu.be/1yelQRZ8LjE
Maybe something Playniax folks can do too, to promote their framework and monkey at the same time?
Ahh I see, that works thanks! I wasn’t understanding what the Instance to pass was meant to be but makes sense now
Ok, I think what I’ll for now is just import the folder (didn’t realise you could do this!), so similar to what I did in Monkey 1. So rather than load the zip you just extract the zip to a folder and #import “folder/” to reference everything that way. Loading it all straight from the zip would be the most ideal solution (without having to extract anything to disk), but not an emergency.
I basically need it to load images and an xml file from a zip file. I seem to recall that currently loadimage only takes a string for the filename, whereas in Blitzmax it took an object which could be a stream, ie from a zip, so not sure if that’s possible yet.
And this is the code in Blitzmax that got the xml string from the zip, so something that can replicate this would be great.
Monkey12345678910Local zip:ZipReader = New ZipReaderzip.OpenZip(filename)Local xmlstream:TStream = zip.ExtractFile("DATA.XML")If Not xmlstream Throw "Error loading effects file!"Local xmlstring:Stringxmlstring = xmlstream.ReadString(xmlstream.Size())Any ETA on miniz? Pretty much all I need now to finish off TimelineFX in monkey2 and add it to the list of modules.
You’ll need to do something along these lines:
Monkey12345Local test_objects:= My_Test_List.All()While not test_objects.AtEndlocal o:=nodes.Currenttest_objects.Erase()wendAugust 24, 2016 at 11:14 pm in reply to: FPS, Delta, FixedFPS, Timing, Animation Topic (almost done) #3431Also, what about the new monitors that run at 120/144hz?
Think you’re just forgetting to add a new FrameSet to the map. Interesting that the method can be called on a null object though.
Monkey12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667Namespace myapp#Import "<std>"#Import "<mojo>"Using std..Using mojo..Class MyWindow Extends WindowMethod New()Local FrameSetCollection:StringMap<FrameSet> = New StringMap<FrameSet>()Local player:Player = New Player(FrameSetCollection, "Bla", 200, 300)EndMethod OnRender( canvas:Canvas ) Overridecanvas.DrawText( "Hello World",Width/2,Height/2,.5,.5 )EndEndFunction Main()New AppInstanceNew MyWindowApp.Run()EndClass FrameSetField Position:= New Vec2fMethod Move:Void(_mx:Float, _my:Float)' Print _mx' Print _my' HERE IS THE ERROR, CREATING NEW VEC2F''' Position=New Vec2f - CRASHPosition = New Vec2f(_mx,_my)EndEnd ClassClass SpriteField FrameSetCollection:StringMap<FrameSet>Field FrameSetColKey:StringMethod New(_FrameSetCollection:StringMap<FrameSet>,_FrameSetColKey:String)FrameSetCollection = _FrameSetCollectionFrameSetColKey = _FrameSetColKeyFrameSetCollection.Add(FrameSetColKey, New FrameSet) '<<<<<EndEnd ClassClass Player Extends SpriteMethod New(_FrameSetCollection:StringMap<FrameSet>,_FrameSetColKey:String,_initX:Float,_initY:Float)Super.New(_FrameSetCollection,_FrameSetColKey)_FrameSetCollection.Get(_FrameSetColKey).Move(_initX,_initY)EndEnd ClassAugust 7, 2016 at 2:32 pm in reply to: What do you do if it parses fine but the linker throws up? #2843There’s still some things in the parser that misses these errors before they get to the compiler but they’re getting added overtime I think. It could also just be a bug in mx2cc that’s not translating properly.
If it happens to me then I look at what the compiler is pointing at, usually a variable, and then try and figure it out from there.
Monkey123C:/Users/Micha/Desktop/FantomMonkey/monkey2/modules/monkey/native/bbgc.h:186:16: error: cannot dynamic_cast ‘((bbGCVar<t_fantomX2_ftLayer>*)this)->bbGCVar<t_fantomX2_ftLayer>::_ptr’ (of type ‘struct t_fantomX2_ftLayer*’) to type ‘struct bbGCNode*’ (source is a pointer to incomplete type)bbGC::enqueue( dynamic_cast<bbGCNode*>( _ptr ) );^It’s interesting that it seems to be the garbage collector complaining about a struct (t_fantomX2_ftLayer) or a pointer to a struct when I didn’t think the GC got involved with structs, not that I know much about the inner workings!
You can grab a sub-section of an image with new image(image, recti) plus there’s a few other overloaded options I think. Here’s my function to load an animation from a spritesheet, it might have what you’re looking for?
Monkey123456789101112131415161718192021222324252627282930313233343536373839404142Function LoadFrames:Image[] (path:String, numFrames:Int, cellWidth:Int, cellHeight:Int, padded:Bool = False, flags:TextureFlags = TextureFlags.Filter, shader:Shader = Null)Local material:=Image.Load( path, flags, shader )If Not material Return New Image[0]If cellWidth * cellHeight * numFrames > material.Width * material.Height Return New Image[0]Local frames:= New Image[numFrames]If cellHeight = material.HeightLocal x:=0local width:=cellWidthIf paddedx += 1width -= 2End ifFor Local i:=0 Until numFrameslocal rect:= New Recti(i * cellWidth + x, 0, i * cellWidth + x + width, cellHeight)frames[i] = New Image(material, rect)NextElseLocal x:= 0, width:= cellWidth, y:= 0, height:= cellHeightLocal columns:= material.Width / widthIf paddedx += 1y += 1width -= 2height -= 2End IfFor Local i:=0 Until numFramesLocal fx:Int = i Mod columns * cellWidthLocal fy:Int = i / columns * cellHeightlocal rect:= New Recti(fx + x, fy + y, fx + x + width, fy + y + height)frames[i] = New Image(material, rect)NextEnd IfReturn framesEndI’m not sure what the variable scope is when it comes to lambdas in monkey 2, I know that would work in javascript, but it’s probably out of scope here, unless it’s a bug…
You might want to look at stacks which by my understanding are basically arrays that you can resize easily.
I haven’t touched the collision code, only added all the extra timelinefx stuff so it should be all the same when I eventually merge it all.
I think my approach was to separate the collision box from the entity rather then try to use it as the thing that manages all the coordinates of the entity. I guess you could do it like that but as tlBox doesn’t come with a local vector (only world) you would have to extend it and then override tForm() to transform stuff from local to world.
So I would have the entity have it’s own vectors to manage its position and update it’s collision box each update, which is a little bit more overhead but ultimately more flexible. That also goes back the other way if you use prevent overlap, whereby the collision box would need to update the entity coordinates after a collision.
Under the particles branch on github there is gameobject which might help (https://github.com/peterigz/timelinefx.monkey2/blob/particles/gameobject.monkey2). I think use a couple of collision boxes, one for actually calculating the collisions, and a container box, which updates to envelope the whole entity for off screen culling and such. I wrote it a while ago though so I’m not sure what everything does!
Great, no rush as I’ll just be spending a few weeks optimising and refining for now. Will I be able to extract a file to memory or a buffer/stream and load it from there without any actually extracting to disk? Ie., get to a png in the zip and load it via a stream somehow.
-
AuthorPosts