Oxanoid Tutorial Series

Editor
Feb 2, 2010 at 9:39 PM
Edited Feb 3, 2010 at 12:07 AM

Part 1 is Up! Please bear with me as i write the other parts and PLEASE tell me if something doesnt work.

 

http://www.greymatterscomic.com/oxgameengine/OxanoidTutorialPart1-Html.zip

http://www.greymatterscomic.com/oxgameengine/OxanoidTutorialPart1-Code.zip

thanks

bubzy.

updated 3rd feb 01:07 am GMT

Coordinator
Feb 2, 2010 at 10:00 PM

First link doesn't appear to work ;P

Coordinator
Feb 2, 2010 at 10:12 PM

Seems to work for me now :)

 

Coordinator
Feb 2, 2010 at 10:18 PM

Looks wonderful so far bubzy :)

First minor correction -

hitPoints = int.Parse(Component.DesignTimeData);

- no need to reach through the component to get DesignTimeData as its available directly to the script like so -

hitPoints = int.Parse(DesignTimeData);

Convenient, eh?

Coordinator
Feb 2, 2010 at 10:25 PM

Another issue is how you get rid of blocks once they're 'defeated'. There's a better way to destroy entities directly...

but...

I can't remember what it was :)

Gonna need a moment on that :)

Coordinator
Feb 2, 2010 at 10:43 PM

Ah, I guess I never ended up doing it after all. Well, it's done now in the latest SVN.

To get rid of an scripted component permanently, just call Dispose().

Now that I think about it, in your case, you may want to keep the block around to be restored later. Whether or not you actually want to dispose it depends on that.

BTW, once we get the kinks worked out of Ox (next release), it would be great to aim the tutorial at people who are not using the source code, but rather the latest installer.

Editor
Feb 2, 2010 at 11:42 PM
Edited Feb 2, 2010 at 11:56 PM

Now that I think about it, in your case, you may want to keep the block around to be restored later. Whether or not you actually want to dispose it depends on that.

im actually using different scenes for different levels, when i DestroyDomain("Oxanoid"); and then reload a scene, does it matter if i have destroyed these blocks already?

edit - does this destroy the whole script? by this i mean, do i have to destroy the body seperately?

thanks. (fixes in progress for tutorial)

Coordinator
Feb 3, 2010 at 12:24 AM
Edited Feb 3, 2010 at 12:25 AM

Everything is destroyed as expected when you do DestroyDomain.

Destroying the script also destroys the component and, since you are destroying the body in the script's Dispose override, that will be destroyed too.

It should all work automagically :)

Coordinator
Feb 3, 2010 at 2:13 PM

One thing that I realized is that we should never read from PositionWorld, ScaleWorld, or OrientationWorld in when setting up physics bodies. This is because we will be writing to Position, Scale, and Orientation later, not PositionWorld, ScaleWorld, and OrientationWorld. Reading from PositionWorld then writing to Position doesn't really make any sense. I should have been more careful when pasting example code to you guys.

I'd say let's replace all uses of PositionWorld, ScaleWorld, and OrientationWorld with their local (non-prefixed) counterparts in this tutorial.

Let me know if you need more detailed reasoning.

Coordinator
Feb 8, 2010 at 7:04 PM

Hey Bubzy!

I just wanted to notify you that a recent change I made for DiamondBack has affected the way that scripts can be destroyed. Now there are two ways -

1) The normal way of calling Dispose() on the script. This no longer destroys the underlying component.

2) The special way of calling DisposeWithComponent() on the script. This gets rid of the script and its component.

Cheers!

 

Coordinator
Feb 8, 2010 at 7:08 PM

I actually just renamed DisposeWithComponent to DisposeIncludingComponent. The latter seems to be more in line with the caller's intent.

Cheers again!

 

Editor
Feb 8, 2010 at 10:22 PM

ok cool, im a little tied up with my main project at the moment, will update the tutorial and its files with all the new changes soon.