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: Help Req]: Goodnight's Menu Engine  (Read 1389 times)

0 Members and 1 Guest are viewing this topic.

Dark-Hylian

Silence
Help Req]: Goodnight's Menu Engine
« on: February 28, 2010, 07:18:48 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 370
How would one go about making a second item through use of Goodnight's engine? (Aside from needing to allign my menu box with the sprites for the images and vice versa, which I have yet to figure out the code for...
Code: [Select]
//if inventory[a] = 1
if a=0 or a=4 or a=8
{draw_sprite(menu_items,a,x+(a mod 4)*30+36,y+floor(a/4)*30+z);}
else if a>4 and a<8
{draw_sprite(menu_items,a,x+(a mod 4)*30+h,y+floor(a/4)*30+z);}
else if a>8 and a<12
{draw_sprite(menu_items,a,x+(a mod 4)*30+h,y+floor(a/4)*30+z);}
else if a>0 and a<4
{draw_sprite(menu_items,a,x+(a mod 4)*30+h,y+floor(a/4)*30+z);}
pen_color = c_black
//draw_sprite(select,-1,x+(global.weapon mod 4)*30+20,y+floor(global.weapon/4)*30)

//if inventory[global.weapon] = 1{
draw_sprite(itemnames,global.weapon,view_xview[0]+209,view_yview[0]-66)
draw_sprite(menu_items,global.weapon,view_xview[0]+230,view_yview[0]+45)
i believe it is..)

I've succesfully placed the HuD and everything, so that the selected item ends up at the right place, the top right of the HuD. However, how would one use

Show content
Code: [Select]
depth = -15

if deactivated = 1{

if keyboard_check(vk_right) = 1 and global.weapon < 14 {global.weapon+=1; io_clear();}
if keyboard_check(vk_left) = 1 and global.weapon > 0 {global.weapon-=1; io_clear();}
if keyboard_check(vk_up) = 1 and global.weapon >4 {global.weapon-=4; io_clear();}
if keyboard_check(vk_down) = 1 and global.weapon < 14 {global.weapon+=4; io_clear();}
if global.weapon>14
{global.weapon=14}
brush_color = c_black
pen_color = c_black
draw_rectangle_color(view_xview[0]-50,view_yview[0]-50,view_xview[0]+400,view_yview[0]+400,c_black,c_black,c_black,c_black,0)

draw_sprite(sprmenu,global.weapon+1,x,y)
//draw_sprite(sprmenu,0,view_xview[0]+30,view_yview[0]+40)
for(a=0; a<13 a+=1){
if a=3 or a=4
{h=50}
else if a=7 or a=8
{h=50}
else if a=11 or a=12
{h=50}
else
{
if a>0 and a<4 or a=0
{h=45}
else if a>4 and a<8 or a=4
{h=45}
else if a>8 and a<12 or a=8
{h=45}
}
if a>0 and a<4 or a=0
{z=16}
else if a>4 and a<8 or a=4
{z=12}
else if a>8 and a<12 or a=8
{z=8}
//if inventory[a] = 1
if a=0 or a=4 or a=8
{draw_sprite(menu_items,a,x+(a mod 4)*30+36,y+floor(a/4)*30+z);}
else if a>4 and a<8
{draw_sprite(menu_items,a,x+(a mod 4)*30+h,y+floor(a/4)*30+z);}
else if a>8 and a<12
{draw_sprite(menu_items,a,x+(a mod 4)*30+h,y+floor(a/4)*30+z);}
else if a>0 and a<4
{draw_sprite(menu_items,a,x+(a mod 4)*30+h,y+floor(a/4)*30+z);}
pen_color = c_black
//draw_sprite(select,-1,x+(global.weapon mod 4)*30+20,y+floor(global.weapon/4)*30)

//if inventory[global.weapon] = 1{
draw_sprite(itemnames,global.weapon,view_xview[0]+209,view_yview[0]-66)
draw_sprite(menu_items,global.weapon,view_xview[0]+230,view_yview[0]+45)

}
}


else{

}

var box_x, box_y;
box_x = view_xview +230
box_y = view_yview + view_hview - 230
draw_sprite(itembox, 0, box_x, box_y)
//if objmenu.inventory[global.weapon] = 1
draw_sprite(menu_items,global.weapon,view_xview + 235,view_yview + view_hview - 225)
to make a second selectable item?
Logged
  • Dawning Hour
Re: Help Req]: Goodnight's Menu Engine
« Reply #1 on: February 28, 2010, 08:17:16 am »
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3725
How would one go about making a second item through use of Goodnight's engine? (Aside from needing to allign my menu box with the sprites for the images and vice versa, which I have yet to figure out the code for...
Code: [Select]
//if inventory[a] = 1
if a=0 or a=4 or a=8
{draw_sprite(menu_items,a,x+(a mod 4)*30+36,y+floor(a/4)*30+z);}
else if a>4 and a<8
{draw_sprite(menu_items,a,x+(a mod 4)*30+h,y+floor(a/4)*30+z);}
else if a>8 and a<12
{draw_sprite(menu_items,a,x+(a mod 4)*30+h,y+floor(a/4)*30+z);}
else if a>0 and a<4
{draw_sprite(menu_items,a,x+(a mod 4)*30+h,y+floor(a/4)*30+z);}
pen_color = c_black
//draw_sprite(select,-1,x+(global.weapon mod 4)*30+20,y+floor(global.weapon/4)*30)

//if inventory[global.weapon] = 1{
draw_sprite(itemnames,global.weapon,view_xview[0]+209,view_yview[0]-66)
draw_sprite(menu_items,global.weapon,view_xview[0]+230,view_yview[0]+45)
i believe it is..)

I've succesfully placed the HuD and everything, so that the selected item ends up at the right place, the top right of the HuD. However, how would one use

Code: [Select]
depth = -15

if deactivated = 1{

if keyboard_check(vk_right) = 1 and global.weapon < 14 {global.weapon+=1; io_clear();}
if keyboard_check(vk_left) = 1 and global.weapon > 0 {global.weapon-=1; io_clear();}
if keyboard_check(vk_up) = 1 and global.weapon >4 {global.weapon-=4; io_clear();}
if keyboard_check(vk_down) = 1 and global.weapon < 14 {global.weapon+=4; io_clear();}
if global.weapon>14
{global.weapon=14}
brush_color = c_black
pen_color = c_black
draw_rectangle_color(view_xview[0]-50,view_yview[0]-50,view_xview[0]+400,view_yview[0]+400,c_black,c_black,c_black,c_black,0)

draw_sprite(sprmenu,global.weapon+1,x,y)
//draw_sprite(sprmenu,0,view_xview[0]+30,view_yview[0]+40)
for(a=0; a<13 a+=1){
if a=3 or a=4
{h=50}
else if a=7 or a=8
{h=50}
else if a=11 or a=12
{h=50}
else
{
if a>0 and a<4 or a=0
{h=45}
else if a>4 and a<8 or a=4
{h=45}
else if a>8 and a<12 or a=8
{h=45}
}
if a>0 and a<4 or a=0
{z=16}
else if a>4 and a<8 or a=4
{z=12}
else if a>8 and a<12 or a=8
{z=8}
//if inventory[a] = 1
if a=0 or a=4 or a=8
{draw_sprite(menu_items,a,x+(a mod 4)*30+36,y+floor(a/4)*30+z);}
else if a>4 and a<8
{draw_sprite(menu_items,a,x+(a mod 4)*30+h,y+floor(a/4)*30+z);}
else if a>8 and a<12
{draw_sprite(menu_items,a,x+(a mod 4)*30+h,y+floor(a/4)*30+z);}
else if a>0 and a<4
{draw_sprite(menu_items,a,x+(a mod 4)*30+h,y+floor(a/4)*30+z);}
pen_color = c_black
//draw_sprite(select,-1,x+(global.weapon mod 4)*30+20,y+floor(global.weapon/4)*30)

//if inventory[global.weapon] = 1{
draw_sprite(itemnames,global.weapon,view_xview[0]+209,view_yview[0]-66)
draw_sprite(menu_items,global.weapon,view_xview[0]+230,view_yview[0]+45)

}
}


else{

}

var box_x, box_y;
box_x = view_xview +230
box_y = view_yview + view_hview - 230
draw_sprite(itembox, 0, box_x, box_y)
//if objmenu.inventory[global.weapon] = 1
draw_sprite(menu_items,global.weapon,view_xview + 235,view_yview + view_hview - 225)
to make a second selectable item?
First of all, only put spoilers between spoiler tags. There is no use for code to be put between spoiler tags. Not to mention that spoiler tags disable all other tags.

Okay, now what is your problem. It is hard to decipher. You are talking about a second item to use and to draw the menu. I have no clue what you want to do with the code, but it looks like you are trying to draw menu stuff. But your problem is not clear at all.
Logged

Dark-Hylian

Silence
Re: Help Req]: Goodnight's Menu Engine
« Reply #2 on: February 28, 2010, 01:10:54 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 370
Sorry for not being very clear. What I meant, was a second Item select that would allow you to pick a second item and assign it to a different key. I understand the concept, and how it should assign the item by which key you press. It's probably simpler than I think it is, but how would you modify the code to use a second select based off a different key, and then switch the items selected, ie, Z Item is the bow. You X select the Bow. X Item becomes Bow, and Z Item becomes whatever X was, or empty if it was nothing. As I said, it's probably simple, but I was both tired, and i had (still have) a terrible headache. Anyways, any suggestions?

Edit

As well, how would one manage to make it so that:

If the item we've selected, by space, we have, inventory
  • =1.

And if we've pressed the A key.
We draw that sprite, respectively, on the HuD, and the select resets to one.
Then, repeat for the D key, save that A and D's selected inventory[] cannot be the same.

Code: [Select]
if keyboard_check(ord("A"))and objMenu.inventory[global.weapon1] = 1{
draw_sprite(menu_items,global.weapon1,view_xview + 250,view_yview + view_hview - 245)}

Currently, any item selected will be drawn on the HuD in the A position. How to go about making it drawn and stay drawn only if the A key has been pressed?
« Last Edit: February 28, 2010, 06:56:12 pm by Dark-Hylian »
Logged
  • Dawning Hour
Re: Help Req]: Goodnight's Menu Engine
« Reply #3 on: February 28, 2010, 09:03:55 pm »
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3725
Sorry for not being very clear. What I meant, was a second Item select that would allow you to pick a second item and assign it to a different key. I understand the concept, and how it should assign the item by which key you press. It's probably simpler than I think it is, but how would you modify the code to use a second select based off a different key, and then switch the items selected, ie, Z Item is the bow. You X select the Bow. X Item becomes Bow, and Z Item becomes whatever X was, or empty if it was nothing. As I said, it's probably simple, but I was both tired, and i had (still have) a terrible headache. Anyways, any suggestions?
if I understand it correct then you just want to swap the assigned items of the item buttons, when you assign an item that is already assigned to the other button. And don't do this when the item is not assigned to the other button. Okay that is really simple, in pseudo code:

Code: [Select]
// Z_weapon is the weapon assigned to the Z item button
// X_weapon is the weapon assigned to the X item button
// i is the weapon selected to be assigned to a button

if( pressed( Z ) && hasWeapon( i ) ){
   if( i == X_weapon ){
      X_weapon = Z_weapon
   }
   Z_weapon = i
}
This pseudo code assumes you do it in the step event. If you do it in a key press event than you don't have to check if the key is pressed. And to do it for the other button just switch the X and Z.


As well, how would one manage to make it so that:

If the item we've selected, by space, we have, inventory
  • =1.

And if we've pressed the A key.
We draw that sprite, respectively, on the HuD, and the select resets to one.
Then, repeat for the D key, save that A and D's selected inventory[] cannot be the same.

Code: [Select]
if keyboard_check(ord("A"))and objMenu.inventory[global.weapon1] = 1{
draw_sprite(menu_items,global.weapon1,view_xview + 250,view_yview + view_hview - 245)}

Currently, any item selected will be drawn on the HuD in the A position. How to go about making it drawn and stay drawn only if the A key has been pressed?
Once again you don't really make sence. It would be nice to know what the space key, A key and D key have to do. But if you only want to draw an icon when the respective key is held down then just do keyboard_check( key ) and only draw if it returns true.
Logged

Dark-Hylian

Silence
Re: Help Req]: Goodnight's Menu Engine
« Reply #4 on: February 28, 2010, 09:46:53 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 370
Nevermind, I believe I have it figured out, and you'll here from me again if I havn't.
Logged
  • Dawning Hour
Pages: [1]   Go Up

 


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



Page created in 0.166 seconds with 47 queries.