Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: Using outside resources  (Read 1550 times)

0 Members and 1 Guest are viewing this topic.

Xiphirx

wat
Using outside resources
« on: February 15, 2008, 12:01:26 am »
  • Xiphirx
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3007
I have one quick question...
consider the layout below
//FILES IN EXPLORER
----.>Project name (folder)
-------->EXE (Exectubale)
-------->GFX------->sprite1 (resource)

in game maker, how would i be able to use sprite1 in the exe without adding it as a resource?
is there a dll for this?

thanks I need this for my projects right now which i hope you guys will love :)
Logged
  • For The Swarm

alirazaq

Re: Using outside resources
« Reply #1 on: February 15, 2008, 12:06:37 am »
You drag and drop it in gamemaker, and gamemaker saves it into the exe
Logged
Re: Using outside resources
« Reply #2 on: February 15, 2008, 05:15:57 pm »
  • Fear my Blades
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 562
GM has a couple functions for adding resources at run-time, those are probably what your looking for.

Quote
sprite_add(fname,imgnumb,precise,transparent,smooth,preload,xorig,yorig) Adds the image stored in the file fname to the set of sprite resources. Only bmp, jpg and gif images can be dealt with. When the image is a bmp or jpg image it can be a strip containing a number of subimages for the sprite next to each other. Use imgnumb to indicate their number (1 for a single image). For (animated) gif images, this argument is not used; the number of images in the gif file is used. precise indicates whether precise collision checking should be used. transparent indicates whether the image is partially transparent. smooth indicates whether to smooth the edges. preload indicates whether to preload the image into texture memory. xorig and yorig indicate the position of the origin in the sprite. The function returns the index of the new sprite that you can then use to draw it or to assign it to the variable sprite_index of an instance. When an error occurs -1 is returned.

sprite_replace(ind,fname,imgnumb,precise,transparent,smooth,preload,xorig,yorig) Same as above but in this case the sprite with index ind is replaced. The function returns whether it is successful.


background_add(fname,transparent,smooth,preload) Adds the image stored in the file fname to the set of background resources. Only bmp and jpg images can be dealt with. transparent indicates whether the image is partially transparent. smooth indicates whether to smooth the edges. preload indicates whether to preload the image into texture memory. The function returns the index of the new background that you can then use to draw it or to assign it to the variable background_index[0] to make it visible in the current room. When an error occurs -1 is returned.

background_replace(ind,fname,transparent,smooth,preload) Same as above but in this case the background with index ind is replaced. The function returns whether it is successful. When the background is currently visible in the room it wil be replaced also.


sound_add(fname,kind,preload) Adds a sound resource to the game. fname is the name of the sound file. kind indicates the kind of sound (0=normal, 1=background, 2=3d, 3=mmplayer) preload indicates whether the sound should immediately be stored in audio memory (true or false). The function returns the index of the new sound, which can be used to play the sound. (-1 if an error occurred, e.g. the file does not exist).

sound_replace(index,fname,kind,loadonuse) Same as the previous function but this time a new sound is not created but the existing sound index is replaced, freeing the old sound. Returns whether correct.


There's also sprite_delete(index), background_delete(index), and sound_delete(index) which you should use when your done with them to free up memory.
Logged

I've done it (sorta)!  Bloom Lighting in GameMaker, and 3D mode too!  Check out the awesome Screen Saver.
  • Kousou Games

Xiphirx

wat
Re: Using outside resources
« Reply #3 on: February 15, 2008, 06:37:12 pm »
  • Xiphirx
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3007
maybe i wasnt clear enough...
i want the resources to stay outside of the exe not to add them
so no sprite_add() or anything like that
sort of like a mpq file for starcraft... :D
Logged
  • For The Swarm
Re: Using outside resources
« Reply #4 on: February 15, 2008, 08:12:22 pm »
  • Fear my Blades
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 562
Those functions don't add them to the .exe file.  They'll load them from outside of it while the game is running.
Logged

I've done it (sorta)!  Bloom Lighting in GameMaker, and 3D mode too!  Check out the awesome Screen Saver.
  • Kousou Games

Xiphirx

wat
Re: Using outside resources
« Reply #5 on: February 16, 2008, 04:27:17 am »
  • Xiphirx
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3007
hmm let me go test ill check back
Logged
  • For The Swarm

Xiphirx

wat
Re: Using outside resources
« Reply #6 on: February 16, 2008, 08:03:05 pm »
  • Xiphirx
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3007
OMG that was easy, maybe id i wasnt lazy to try i wouldnt have posted here...
Thanks artius i owe yoiu one XD
Logged
  • For The Swarm
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.019 seconds with 48 queries.