IvanK Posted March 5, 2013 Share Posted March 5, 2013 Hello, let me introduce you my new open-source library PolyK - http://polyk.ivank.net . It is written in pure JavaScript, without any bindings to DOM, CSS or anything else. It is a set of several functions, which take an array of numbers and process it. It my be useful for some games, but you can use it even for non-graphical computation. I have several ideas for games, which may use that library. I don't have a time to make them, but maybe you will you click on some button in the middle of labyrinth (polygon) and you have to get mouse cursor out without touching the polygon. (PolyK.ContainsPoint) using PolyK.ClosestEdge you can test intersection with polygon and circle. You can make balls bouncing inside the polygon and then a character, which should go throught the polygon avoiding those balls. You can make car racing. Real physical models (Box2D, Bullet) are usually bad for car racing. With PolyK you can make pseudo-physical model. If you attach Z coordinate to road points and interpolate it, you can make 3D racing with jumping above the road, just like Need for speed With raycasting, you can test visibility between 2 points throught polygon. You can make your secret agent character run through the map while avoiding guards. Using Slice function, you can do something like Fruit ninja, but with multiple slicing and much interesting shapes. soybean 1 Quote Link to comment Share on other sites More sharing options...
rich Posted March 6, 2013 Share Posted March 6, 2013 This is seriously cool Would you have any objections if I converted it to TypeScript? (retaining your license / credits of course) Quote Link to comment Share on other sites More sharing options...
Mike Posted March 6, 2013 Share Posted March 6, 2013 Good work, looks like very useful utilities and and static functions is good simplification. @Rich, thumbs up for the TypeScript convert I'll be looking for it too. Quote Link to comment Share on other sites More sharing options...
zwacky Posted March 6, 2013 Share Posted March 6, 2013 the slicing demo totally reminds me of http://tm.clay.io Quote Link to comment Share on other sites More sharing options...
IvanK Posted March 6, 2013 Author Share Posted March 6, 2013 @rich: sure, convert it into anything you want, it is under MIT licence but insert a link to official page @Mike: thank you @zwacky: Actually, Tiny Monsters is my game and it was the reason why I wrote PolyK Quote Link to comment Share on other sites More sharing options...
rich Posted March 6, 2013 Share Posted March 6, 2013 IvanK - I don't suppose you ever plan on adding rotation support do you? i.e. rotating the polygon from any given point within it, so that all the nodes rotate central to that. Quote Link to comment Share on other sites More sharing options...
IvanK Posted March 6, 2013 Author Share Posted March 6, 2013 @rich: yes, I was thinking about adding support for affine transformations, but nobody needed it yet. But I can add it in version 0.3 . One can come up with lots of operations on polygons, but I think it is a bad idea to add them, until somebody needs it.BTW. set operations on polygon would be cool (intersection, difference). With difference, you can "cut" polygons from polygon and e.g. make destroyable terrain, like in Worms. Quote Link to comment Share on other sites More sharing options...
rich Posted March 6, 2013 Share Posted March 6, 2013 For me I would consider a transform (or at the very least just rotation) to be much more essential than destroyable terrain (but far less fun I guess!) Then you could map a polygon to a sprite and use it in a game, which would be extremely neat! Quote Link to comment Share on other sites More sharing options...
yetanother Posted March 6, 2013 Share Posted March 6, 2013 This is awesome, thanks for sharing. Quote Link to comment Share on other sites More sharing options...
Desttinghim Posted March 10, 2013 Share Posted March 10, 2013 Trying it in firefox, I couldn't see anything. However, when I switched to chrome it worked perfectly. Does anyone know why this might be? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.