Minecraft Type Game Hotbar help
#1
Posted 08 December 2011 - 10:03 AM
Ok, i have made a game like minecraft, in game maker based on the block engine.
i need some help with a hot bar, where you can scroll to select blocks, and an image
of that block appears in the bottom right hand corner of the screen. Then the player
must right click to place them. i dont accually know how to go about doing this, so any
help would be appreciated, if you would like the gmk, or would like to try the game out so far,
HERE IS A LINK TO THE GMK (mediafire) : http://www.mediafire...irlyb1k9h3wcwrz
Thanks!
#2
Posted 09 December 2011 - 01:04 AM
#3
Posted 09 December 2011 - 01:06 AM
yes i know how to display the 2d hotbar image.I assume you know how to program the selection part of the hotbar. For displaying it, use d3d_set_projection_ortho after you've drawn everything else to draw 2D items to the screen.
#4
Posted 10 December 2011 - 03:21 AM
Also ray tracing.
#5
Posted 12 December 2011 - 12:16 AM
#6
Posted 12 December 2011 - 05:07 AM
#7
Posted 12 December 2011 - 09:52 PM
#8
Posted 12 December 2011 - 10:25 PM
i think you're going down wrong path, im trying to make it so when you scroll or press a number, it changes a variable, and when the player right clicks, he/she places that block.
probably. but does anyone know how 2 do this?
Because you have given a description of what you want, let me tell you how to do it:
"Make it so when you scroll or press a number, it changes a variable, and when the player right clicks, he/she places that block."
You don't want help. You want someone to write simple code for you. Try going to the team request forum and asking for someone to do that. This is a place for help, not for us to write your game for you.
Alternately, go to the Novice Q&A forum and ask "How do I set a variable?"
Edited by Gamer3D, 12 December 2011 - 10:26 PM.
#9
Posted 12 December 2011 - 10:28 PM
#10
Posted 12 December 2011 - 11:14 PM
Ask for help in the Novice + Intermediate forums; your problem has nothing to do with actual 3D game programming.
If you want to continue here, post code of what you have done.
#11
Posted 12 December 2011 - 11:20 PM
if block_intersect(600)
{
if mouse_check_button_pressed(mb_right)
if global.selected = 1
{
add_ball(x2,y2,z2, radius, choose(5))
{
}and then i just kept going. except when the global.selected changed, i just put in different code (just changes the block being placed)
#12
Posted 14 December 2011 - 02:41 AM
#13
Posted 14 December 2011 - 04:33 AM
This doesn't matter in Game Maker because it will never assign a variable inside of a test, and the compiler ignores parentheses unless they are grouping tests, unlike in C for example where they are required.My first guess is the combination of using the assignment operator "=" instead of the conditional operator "==" and the lack of parenthesis
secondry2, I'm guessing by your code that choose(5) is what randomizes the block. You may have typed this wrong, the choose() function returns a random one of its arguments, and so it will always return 5 in this case. So replace choose(5) with a variable that holds the selected block type. You can increment the variable with in scroll wheel up event.
edit: cleared some stuff up.
Edited by jsorgeagames, 14 December 2011 - 04:34 AM.
#14
Posted 14 December 2011 - 05:52 AM
link3000: is there anything wrong with the layout? and plus, it looks correct 2 me
#15
Posted 15 December 2011 - 01:31 AM
I was actually wondering what that choose(5) was supposed to represent? You can use variables as arguments, if that was what you meant. It just passes along the value of the variable, not the actual variable like passing a pointer in C/C++ would.
#16
Posted 15 December 2011 - 10:23 PM
link3000: basically, all it does, is checks for ur cursor to b placed on a block (simply) and if that is true, then it will check for the mouse button right to b pressed, and if that is true, it will check what block is 2 b placed (using a variable, the variable doesnt accually mean anything, its just there 2 ditirmin which block is placed) and in this case, if the the global variable, selected is one, it will place that block. And for the "choose(5)", all that the choose(5) represents, is the choose means "choosing" a random argument. 5 is one of the arguments (in this case it is a type of block
Edited by secondry2, 15 December 2011 - 10:24 PM.
#17
Posted 21 December 2011 - 06:08 AM
#18
Posted 21 December 2011 - 09:00 PM
What?link3000: basically, all it does, is checks for ur cursor to b placed on a block (simply) and if that is true, then it will check for the mouse button right to b pressed, and if that is true, it will check what block is 2 b placed (using a variable, the variable doesnt accually mean anything, its just there 2 ditirmin which block is placed) and in this case, if the the global variable, selected is one, it will place that block. And for the "choose(5)", all that the choose(5) represents, is the choose means "choosing" a random argument. 5 is one of the arguments (in this case it is a type of block
...what?Ha well I got the display image prob ya don't know how to do it in lite version and my minecraft is 2d so placing blocks is really easy
@Secondry2 - Did you fix your problem, or are there still issues?
#19
Posted 21 December 2011 - 09:37 PM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











