Latest Uploads
Invasion V ... prototype

rychan

Invasion V ... Prototype

rychan

Shields 64x64

Pakz

Ffs_Spam

Jayenkai

Hives Screen shot

rychan

Rpg Potion Sprites

Pakz

Back to steve_ancell's Blog ( Created 08 August 2016 | Last Edited 08 August 2016)
Monkey-X Box2D: Learning from my perspective... Hopefully!
Learning Box2D with Monkey-X: Based on my personal experience.

So, I decided to have a go at using the Box2D/monkeybox2d module. At the moment I've been attempting to break down some tutorials,
which were kindly provided by skid over at monkey-x.com, into small chunks in order to make it more understandable.

This was done to help me understand how to use the Box2D module, but maybe whoever else is reading this may also benefit from this too.
Over time I will break down, or maybe just break it altogether, what I learn into code snippets that I hope can become useful to me and whoever.
I will start with showing results as a debug drawing and then hopefully transition over to proper graphics as this progresses,
I just hope I don't wind up boring you all in the process.

I have so far isolated the part that creates the world with noting else in it, I will add more to this blog as I go along.

Creating the world:

This is the bare-essentials for setting up a Box2D environment.

Although stuff could probably be done in the C_Game class, which is what I originally intended as to try simplifying what does what,
it seems to be easier to handle if the Box2D stuff is inside of another class like I've done here with the C_Box2D class.

-->


Next: Will be adding some rectangles to the environment, stay tuned!


__________________________________________________________



In this installment I will be adding some stuff that fills the environment with, well..., stuff!.
In this case it will be stationary and falling rectangles.

I've added a few methods and static globals, listed below.

Inside C_Box2D:
Global FixtureDef:= New b2FixtureDef()
Global BodyDef:=New b2BodyDef()
Global Impulse:=New b2Vec2

CreateBody
AddSquareFixture
ApplyImpulse

Inside C_Game

MakeWorld

Const STATIC_BODY:Int
Const KINEMATIC_BODY:Int
Const DYNAMIC_BODY:Int

AddRect


-->

Latest Comments

Posted : Monday, 08 August 2016, 03:56
steve_ancell


Instead of keep adding comments I will just edit the main blog as I add stuff, this will help to keep any other comments separate from the stuff above.

Homepage : http://homepage.ntlworld.com/stephen.ancell/index.htm
Posted : Monday, 08 August 2016, 04:00
Jayenkai


"Only adding to the main blog" will only ever add to the main blog. It won't flag up the new content as an unread post in the sidebar.
As such, be sure to post a comment, like "Today I tackled X/achieved Y/broke Z" if it's been a while since the last update. (eg a few hours, not spamming every 10 seconds )

Homepage : http://AGameAWeek.com
Posted : Monday, 08 August 2016, 04:02
steve_ancell


OKies, I'll do it like that instead.

Homepage : http://homepage.ntlworld.com/stephen.ancell/index.htm
Posted : Monday, 08 August 2016, 05:11
steve_ancell


Added a new method, AddBall... Now it has balls!!!

That's it for the time being, I am now off to learn how to apply forces, and torque to balls. I did say torque, not talk; not that I talk to balls, unlike Tom Hanks, but then again some do.


-->

Homepage : http://homepage.ntlworld.com/stephen.ancell/index.htm
Posted : Tuesday, 09 August 2016, 07:06
steve_ancell


Today I've been toying around with torque. I've now defined a 2dBody in the ball field and applied torque to that. I also changed the platforms for a bit of fun.

Left and right arrows roll the ball in the relevant direction. I did originally include a DrawText command to show this on screen, but DrawText seems to make the framerate rather shite.


-->



Next: Not sure yet, maybe I'll look into adding graphics for the next installment. Stay tuned!

Homepage : http://homepage.ntlworld.com/stephen.ancell/index.htm
Posted : Friday, 12 August 2016, 09:00
steve_ancell


I'm a big kid, look what I can do!... Me been playing with compound shapes.

Remove the F_DebugMessage commands from OnUpdate in the C_Game class if you want the simulation to run at full chat.


-->

Homepage : http://homepage.ntlworld.com/stephen.ancell/index.htm
Posted : Friday, 12 August 2016, 13:40
steve_ancell


One problem has arisen, the left polygon in the compound shape doesn't seem to be colliding with the circle.

*Back to the drawing board in search of a solution*

Homepage : http://homepage.ntlworld.com/stephen.ancell/index.htm
Posted : Saturday, 13 August 2016, 09:14
steve_ancell


I've found that compound shapes collide a whole lot better whn the vertices are added when the first vector is added at top left and the rest are added in a clockwise fashion.

Also been using actual images with this, I will post in here again once I get something more stable going.

Homepage : http://homepage.ntlworld.com/stephen.ancell/index.htm
Posted : Saturday, 20 August 2016, 06:32
steve_ancell


I've been having a roustabout with top-down car physics. A bit crappy and uncontrollable I know, but it's a start.

From the code, most of this is quite self explanatory.

[Edit]Oops!, I forgot to include the media |edit|

Highslide JS This goes in "root\Try_04.data\Graphics"

-->

Homepage : http://homepage.ntlworld.com/stephen.ancell/index.htm
Posted : Sunday, 21 August 2016, 14:49
steve_ancell


I have found that top down car physics is easier to impliment with a single rectangular body without the wheels. It's now a lot easier to control but it now moves like it's on a track, it needs to have some sort of sideways inertia to give it the feeling of drift on tight corners. i'm planning on trying some sort of dual-mass approach, in the meantime here is the code for what I've done recently.


-->

Homepage : http://homepage.ntlworld.com/stephen.ancell/index.htm
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 575|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Latest Posts
Crystal Maze
zzoom Fri 23:02
Update All Objects in Array?
Caton Fri 20:09
CSS-Me-Do - SoCoder2
rskgames Fri 09:45
Delete Button on Showcases
Pakz Fri 09:13
Grenfell Fridge
Jayenkai Fri 09:02
ProcGen Book
Pakz Fri 07:11
XB360 /XBOne Pads
STEVIE G Thu 23:28
Cerberus X - the continuation of Monkey X
Jayenkai Thu 03:54
Winter Solstice
therevillsgames Wed 16:47
AGameAWeek : 2017 - Part One
Jayenkai Wed 15:10
More

Latest Items
Link : Learn C++
rychan Fri 03:13
Dev-Diary : My Journey into NES Development
Jayenkai Thu 03:58
Showcase : A Civilization Clone v0.4
rychan Thu 03:27
News : Newsletter #320
Jayenkai Tue 18:47
Blog : sadas
hardcoal22 Tue 02:50
Showcase : Flappadiddle
Jayenkai Mon 08:20
Article : Cookie Information
rychan Sun 12:28
Dev-Diary : Wii to N64 adapter
spinal Sat 11:50
Link : MonkeyX code examples
Jayenkai Sat 06:42
Link : Available Languages
Jayenkai Thu 13:22
Blog : Mr Testo Tests
Socoder Tue 07:21
Link : Chrome VR Experiments
Jayenkai Tue 06:49
Showcase : Orbital Projectiles
Jayenkai Tue 06:39
Showcase : Hives
zzoom Fri 16:10
More

Who's Online
zzoom
Fri, at 23:08
Caton
Fri, at 23:07
Pakz
Fri, at 22:59
9572AD
Fri, at 22:45
rskgames
Fri, at 21:57
therevillsgames
Fri, at 19:11
GfK
Fri, at 18:37
Jayenkai
Fri, at 16:31
steve_ancell
Fri, at 16:31
rychan
Fri, at 15:42
Link to this page
Site : Jayenkai 2006-Infinity | MudChat's origins, BBCode's former life, Image Scaler.