It is extremely simple to add objects to the world in Ragnarok. All you have to do is create the object and call add_obj from the Ragnarok engine instance. Below follows a more in-depth example:
A Sprite is essentially a container object for an image that allows us to manipulate properties of it extremely easily. Let’s start by creating the object.
sprite = R.Sprite()
Since we are adding only one object to the world, the update and draw orders don’t carry much significance as of yet. But if we were to add more than one object, these values would be responsible for controlling the order in which the object updates and draws in relation to other objects.
sprite.update_order = 0
sprite.draw_order = 0
Now we assign an image to the sprite by going to the Ragnarok Engine folder and pulling out its logo image.
Now, remember in the previous tutorial how we said that the World is the entity responsible for
managing our objects for us? Well, the last step to get this object onscreen is to
add it to the world so it can be drawn and updated.
Boom! That’s all it takes to get an sprite on the screen. You can play around with the sprite’s coords, scale, and rotation properties to change the orientation of the sprite accordingly.
Download the source for this tutorial here.
Linux user? Download the gzipped tar here.
What is an engine without a few tutorials to get user’s jumpstarted?
This tutorial will cover the basics necessary to get the Ragnarok Engine up and running.
The first step is to import our Ragnarok engine for use.
The ‘as R’ clause here acts as a alias for Ragnarok, meaning we can access its
members by typing R instead of Ragnarok.
import Ragnarok as R
This single line of code is all it takes to actually initalize the engine.
We are telling Ragnarok that we want to create a window of size 640 by 480,
and that it should bear the title “RAGNAROK TUTORIAL 1″.
Notice how we are making use of the Vector2 class to pass in the window size.
engine = R.Ragnarok(R.Vector2(640, 480), “RAGNAROK TUTORIAL 1″)
One of Ragnarok’s goals is to reduce micro management in your code. It does this by automatically
updating and drawing your objects for you. You can control the draw and update order by changing an
object’s update_order and draw_order properties. A low number will draw/update first, while a higher number will draw/update overtop the lower numbers. The world is the entity within the engine that does all this work for us. We grab an instance of it here for easier access.
world = engine.get_world()
The world’s clear_color property defines what color the backbuffer should be
erased to after each draw operation.
world.clear_color = (0, 0, 0)
That’s it! All we have to do now is tell Ragnarok to begin spinning its game loop.
At this point you should be presented with a blank screen. Don’t worry though, Ragnarok can do much more than this!
Check back in for Tutorial 2 to see how to add sprites and other entities to the world.
You can download the source for this tutorial here.
Linux user? Download the gzipped tar here.
>Today I would like to announce the first release of the Ragnarok Engine for Python/Pygame.
Ragnarok is a 2D engine built on top of Pygame to make game creation easier. While Pygame is a library, Ragnarok attempts to assume the role of an engine, featuring many capabilities that would take a lot of work to create from the ground up in Pygame.
The engine is built in such a way that it attempts to be used under any scenario and game environment (i.e. it is generic). It is easy to set up, maintain, and extend for your particular needs.
A few of the features Ragnarok has to offer:
+2D and 3D Math Library
+Sprites for easy rotation, scaling, texture loading, etc.
+SpriteSheet and Animation classes
+Text objects that can be rotated, scaled, and translated
+A customizable 2D Camera
+A managed World system that updates, draws, and automatically offsets objects by the camera’s
+Input Handling Systems
+Pool class for efficiently reusing objects
Ragnarok is still a work in progress, thus there will be bugs present. Feel free to respond to this post with any bugs you find.
Ragnarok is licensed under the GNU LESSER GENERAL PUBLIC LICENSE v3.0
Download the engine here.Running on Linux? Download the tar here.