Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Sackboy

#1
my basic question is whether it is possible to read/write files from/to different (sub)folders? let's say i have a structure like this:

compiled\data\text\
compiled\data\graphics\lowres\
compiled\data\graphics\highres\
compiled\data\other\

i know that i can use $SAVEGAMEDIR$ with the "file"-functions to achieve this but this doesn't work with the "dynamicsprite"-functions. i don't know whether i am missing something but things like:

Code: ags
File* output = output.Open("data/text/myfile.txt", eFileWrite);
or
DynamicSprite* sprite = DynamicSprite.CreateFromFile("data/graphics/lowres/myfile.png");


don't work. is there a way to access subfolders without using $SAVEGAMEDIR$? and is it possible to load graphics from subfolders at all?

thanks for your help!

Sackboy
#2
oh, cool. i think i misread the manual then. if there is no difference then that's fine for me! ;-D thanks for the fast reply!
#3
i am wondering how fast or slow the

Code: ags
static DynamicSprite* DynamicSprite.CreateFromFile(string filename)


function is. let's say i have 100 external sprites which i load into the game with the function above. i don't want to draw them all the time but on certain events one of them is drawn on a gui/object/screen. now i am not sure how much the engine can take related to:

- is there a limit to how many sprites i can store in variables at the same time (when does it get slow)?
- how many of these stored sprites can i draw at the same time before the game becomes slow?
- how does the image size influence the game speed?

has anyone experience with this?
#4
great, that's it! ;-D thank you!
#5
let's say i create a struct:

Code: AGS
struct MyStruct{

int a;
String b;
DynamicSprite *c;

};


and some new variables for MyStruct:

Code: AGS
MyStruct bla;
MyStruct blub;
MyStruct lala;


now i want to create a function where i am refering to these new variables like this:

Code: AGS
function MyFunction(? var, int sprite){

var.a=var.a+1;
var.b="Hello!";
var.c=DynamicSprite.CreateFromExistingSprite(sprite);

}


instead of:

Code: AGS
function MyFunction(int var1, String var2, DynamicSprite *var3 , int sprite){

var1=var1+1;
var2="Hello!";
var3=DynamicSprite.CreateFromExistingSprite(sprite);

}


is there a way to only refer to the first part of the new MyStruct variables instead of the whole variables?
#6
as i am reading this i am asking myself why i haven't thought of that myself? :P sorry for bothering you and thanks for your help!
#7
i would like to store some external graphics in folders and create dynamic sprites from them at runtime, eg:

Code: AGS
Game.SetSaveGameDirectory("Graphics");
String Filename="Bla.bmp";
String Path=String.Format("$SAVEGAMEDIR$/%s", Filename);

DynamicSprite *sprite=DynamicSprite.CreateFromFile(Path);


in this case sprite gives me a null pointer error but File.Exists(Path); tells me that the file is there. do only the "FILE" commands know "$SAVEGAMEDIR$"? or is there some kind of trick i am missing?

thanks for your help!
#8
i see. so you definitely have to construct something by yourself otherwise you can only adress sounds by their names, is this correct? and thanks for the reply!
#9
how can i play a random sound with the new sound system? with the old one i could do something like:

Code: AGS
PlaySound(Random(99));


is there something similar?
#10
wow, that was fast. thank you sir!  :)
#11
i want to create something like the floating numbers during a battle sequence of a rpg. for that i created a GUI with just one label on it. the label can display any random number. the GUI itself is only visible on certain events. if the GUI is visible the following should happen:

- GUI moves up steadily
- GUI slowly becomes more transparent

here is part of the code i use:

Code: AGS
GUI.Visible=true;

int x=0;

while(x<50){

  GUI.Y=GUI.Y-5;
  GUI.Transparency=GUI.Transparency+2;

  x++;

  Wait(1);

}

GUI.Visible=false;


nothing fancy. the problem i have is that this function is blocking because of "Wait(1);". but if i run it without "Wait(1);" i don't see anything. it's like what happens in the while loop is not displayed.
i am searching for a way to make this code not blocking the game so that the player can still move while the GUI rises up and becomes more and more invisible. would be great if anyone could help me with that. thank you!
SMF spam blocked by CleanTalk