Skip to main content


Topic: Bind an image to the camera (Read 2148 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
Bind an image to the camera
Is there a way to bind an image to the camera?

  • Radnen
  • [*][*][*][*][*]
  • Senior Staff
  • Wise Warrior
Re: Bind an image to the camera
Reply #1
In the map engine there are render scripts. Here is a quick example of how to achieve this:

Code: (javascript) [Select]

function game()
    CreatePerson("player", "some_sprite.rss", false);
    // ...



var my_image = LoadImage("some_image.png");

function MyRender()
    my_image.blit(0, 0); // draws the image at location 0, 0, following the camera.

Render scripts are, in a way, attached to the camera as in they move when it moves. This is useful for showing HUD's and other pieces of info.
If you use code to help you code you can use less code to code. Also, I have approximate knowledge of many things.

Sphere-sfml here
Sphere Studio editor here

  • DaVince
  • [*][*][*][*][*]
  • Administrator
  • Used Sphere for, like, half my life
Re: Bind an image to the camera
Reply #2
Rather than saying they follow the camera, it might be better to say it's not dependent on the map engine's camera at all. Thus, position (0,0) is the top-left of the screen no matter what; the map engine and camera don't factor in at all (except for the fact that a thing like a render script is a map engine thing, I suppose).