IonicWind Software

IWBasic => Games and Graphics => Topic started by: carpman2007 on January 10, 2007, 06:29:56 PM

Title: Large static background in windowed 2D game. How to do it?
Post by: carpman2007 on January 10, 2007, 06:29:56 PM
Hi everyone,

I'm new to this forum.  Just purchased Emergence today (upgraded from IBasic Pro).  Looks very good so far.

I am trying to port a game I wrote in REALbasic to Emergence (much better .EXE file sizes).  However, I am confused as to how to approach something.

With REALbasic, you had something called a SpriteSurface, which was a rectangular control that you drew sprites upon.  As you all know, the EBasic approach is a little different -- you attach a DirectX 2D screen to a regular window, and it covers the entire area.

In my RB game, the SpriteSurface also has a large static image as a background, as opposed to mapped tiles.  This is what I want -- I don't have individual tiles that need to be mapped; rather, I simply have a large static background image that never changes, and I want my sprites to be displayed on top of it.

What I am wondering is, how would I achieve this in EB?  I tried LOADIMAGE and SHOWIMAGE to load one of my backgrounds in the dx_windowed example that came with EB, but it didn't work -- the window was all messed up after that.

I did successfully get it to work using one particular method, but I'm not sure if this is the best way.  What I did was create a sprite that holds the background image.  I display this sprite at 0, 0 so it covers the entire window, then I have the smaller sprites drawn on top of the "background" sprite, and then FLIP occurs.  Is this how I should do it?

Any help would be appreciated (sorry if this post was so verbose).
Title: Re: Large static background in windowed 2D game. How to do it?
Post by: Ionic Wind Support Team on January 10, 2007, 07:21:47 PM
See the 2D users guide for the CREATESPRITE command which allows you to draw directly onto a sprite.   Also the smashout.eba sample will help you along.