Basic Game Example
Monkey Forums/Monkey Programming/Basic Game Example
| ||
Hi Everyone, I'm evaluating monkey and would like to know if there is sample code available that includes things like: 1. Collision 2. Actor movement such as run, jump, walk, idle etc. 3. Score 4. Other basic functions in most games. I've checked the docs and have done forum searches. So if there are more resources please post it and share. Thanks :D |
| ||
Right now there's not a lot of code out there for the stuff in the app section. However all four of your criteria are possible in monkey, but you have to do it yourself using the built-in commands. It sounds like what you are after is a framework that makes the common tasks easier, but there are no such frameworks at the moment for monkey. Anyway, here are a couple of bits of code that may shed some light: MonkeyPong http://www.monkeycoder.co.nz/Community/posts.php?topic=104#451 Asteroids http://www.monkeycoder.co.nz/Community/posts.php?topic=373&app_id=45 |
| ||
Thanks matt, I had a chance to message with MikeHart and he gave me more info. What I like most about Monkey is that I don't need an Internet connection to compile. That's a huge deal with me as I don't always have a connection. I'll check those out and see what I can figure out. I'll post and share what I learn. |
| ||
Hi James, here is a basic circle to circle collision detection. It checks the distance of to vectors, substracts each radius. If the rsult is below zero, a collision has accured. Method CheckCollision:Int(xPos:Float, yPos:Float, xPos2:Float, yPos2:Float, iRadius:Float, iRadius2:Float) Local xdiff:Float Local ydiff:Float Local dist:Float xdiff = xPos - xPos2 ydiff = yPos - yPos2 dist = Sqrt(xdiff * xdiff + ydiff * ydiff)- iRadius - iRadius2 If dist < 0.0 Then Return True Endif Return False End |
| ||
Thanks Mike. It's like we don't talk to each other ever and then all of sudden I feel like I'm drinking from a garden hose with all the messages and posts we've done in the past hour...lol... I have some left over monkeys from a previous game I made too. I think I know what I'll do with them now. A couple of bananas and fruits too...so it'll be good. |
| ||
Yeah, i read your blog about the 48hour challenge you did with Robert. Cool stuff. And the arr you did, awesome. I like it. |