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: [Request / Listing] better way to equip items? (GM6)  (Read 1891 times)

0 Members and 1 Guest are viewing this topic.
[Request / Listing] better way to equip items? (...
« on: June 06, 2006, 07:52:48 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 448
I need a way to equip items to a hud.(oot style)I'm currently trying to convert that part of WWakerFans "somezeldaengine" to GM 6 but with no luck. I can get 2 items to assign to one of the button sprites, but thats it. Little help anyone?

Please put C++, GM, TGF, MMF, RPGMaker etc. in your topic title for easy help!
« Last Edit: February 11, 2012, 07:46:43 am by Niek »
Logged
Re: request: better way to equip items?
« Reply #1 on: June 07, 2006, 07:30:56 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1635
Here's what I do. I store information about each item in a grid data structure. Then, when I want to draw the sprites, I just pull information from the structures in a for loop and then draw it on the screen. DS grids are faster than arrayts when handling lots of information, and they aren't merely two dimensional.

EX:

Setting the information:

Code: [Select]
global.items = ds_grid_create(4,5);

ds_grid_set(global.items,0,0,"Magic Lantern");
ds_grid_set(global.items,0,1,sprLamp);
ds_grid_set(global.items,0,2,view_xview);
ds_grid_set(global.items,0,3,view_yview);
ds_grid_set(global.items,0,4,1);

For example, the last line in this code would set it so you DO have the magic lantern. The second line of code stores the sprite you draw for the c-button. Each item is stored in a different x slot, and all the information is stored in y slots.

Then, you can draw it like this:

Code: [Select]
for(i = 0; i < 3; i += 1) {
      draw_sprite(ds_grid_get(global.items,global.c[i],1),0,ds_grid_get(global.items,global.c[i],2)+cx[i],ds_grid_get(global.items,global.c[i],3)+cy[i]);
}
And you'd have to draw the c buttons, but you get the point, I hope. This is at least how I do it in my game. cx(i] are variables I create which are constants at which I draw the c buttons and items on the screen, so just change those to a value at which you want the sprites to be drawn. Personally, there are my values: "global.c" is a variable which stores the current item I'm using. For example, 1 is the lantern, 2 is the boomerang, etc. So, it pulls information from the grids based on which item is equipped to global.c[0-2]

cx[0] = 187;
cx[1] = 210;
cx[2] = 233;
cy[0] = 26;
cy[1] = 46;
cy[2] = 26;
« Last Edit: June 07, 2006, 07:33:06 am by Scooternew »
Logged
Re: request: better way to equip items? (GM6)
« Reply #2 on: June 07, 2006, 02:51:48 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 448
A small example would be nice, just like 2 items because I'm a little confused ??? . And I also dont have a registered version.
Logged
Re: request: better way to equip items? (GM6)
« Reply #3 on: June 08, 2006, 03:10:32 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1635
Unfortunately, grid data structures require registration. It is very cheap, and it helps further Mark Overmars's development of Game Maker. Of course there are the online free serial keys on websites, but you don't want to have a non-legit key, do you? Plus, it isn't particulary the most honest thing in the world.
Logged
Re: request: better way to equip items? (GM6)
« Reply #4 on: June 08, 2006, 06:13:38 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 448
Ok well I registered, do you think you could help me figure this stuff out?please :)
Logged
Re: request: better way to equip items? (GM6)
« Reply #5 on: June 08, 2006, 06:37:02 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1635
I'll make you an example now that you're registered, but I can't right now. I will later today.
Logged
Re: request: better way to equip items? (GM6)
« Reply #6 on: June 08, 2006, 07:51:39 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 448
Thanks alot :D
Logged
Pages: [1]   Go Up

 


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



Page created in 0.093 seconds with 51 queries.

anything