Dynamic Sprites not working accross multiple resolution?

Started by geork, Sun 20/01/2013 19:03:36

Previous topic - Next topic

geork

Hello All!

I think there's a hidden (or possibly obvious, I just haven't seen it) rule to Dynamic Sprites which I'm not quite twigging. I wrote a piece of code that curiously refuses to work when exported to a game which has a 1024x768 resolution (it was written and tested in a 320x240 resolution) BUT if I export it into a 320x240 game, then increase the game's resolution to 1024x768, it somehow works! Although I did choose the option to change the size of the GUIs upon upgrading in size, that shouldn't make too much difference.
The code is:
Code: AGS
//At top:
DrawingSurface *d;
DynamicSprite *ss;
// Somewhere else
ss = DynamicSprite.Create(Room.Width, Room.Height, false);
//Then, called every cycle from repeatedly_execute_always (after the rain is moved and created)
void DrawRain(){
  d = ss.GetDrawingSurface();
  int i;
  if(CurrRaindrops > 0) d.Clear(); //This is to clear the drawing surface so no overlapping takes place
  while(i < MaxRaindrops){
    //blah blah
    d.DrawImage(rain[i].x, rain[i].y, sprites[i2].s[rain[i].Collided].Graphic); //Draws the right sprite onto the drawing surface (and therefore ss)
                                                                                //Variable i2 is defined within the loop
    i ++;
  }
  object[0].Graphic = ss.Graphic; //object 0 has a position of (0, Room.Height)
  d.Release(); //Cos it's good to do ^_^

The code works, but seemingly not when imported into a game of the size 1024x768 directly. Does anyone have any ideas? I know I can just start a new game at 320x240 and change the size from there, but I'd like to know what is causing this...
  Thanks again!

Khris

You have omitted the most crucial piece of information: HOW does it not work? Does it not do anything at all? Where exactly does it fail?

geork

Ah, balls, you're right. Basically, it doesn't draw the graphic ss to object[0]. The rest of it does work. Apologies for being very melodramatic, sometimes I get carried away on these things... :S

Thanks!

EDIT: Okay, this is very odd. I started an entirely new game at 1024x768, and it worked fine when called. Unfortunately there was nothing in the other 1024x768 game to have interfered in any way (they were both made in the same version of AGS and neither interfered with the imported script). My apologies if I'm wasting time (which I'm beginning to feel I am :P) it just seems really strange...

Khris

The usual reason for stuff like that failing to work is the DynamicSprite being a local variable that gets destroyed at the end of the function.
Not sure how helpful that is though, because if that's the reason, it should work either always or never.

geork

Hmm, the only other piece of info is that the first 1024x768 game was emailed to myself, so the files aren't strictly speaking the originals. But again, that probably shouldn't factor. I've set up a new game project at 1024x768 and it all works fine (i.e. the graphic is drawn). Apologies if this was a waste of time, and many thanks again for taking the time to read and comment Khris :)

SMF spam blocked by CleanTalk