in discussion The Community / Game Maker Help » Keyboard Check Question
Read the manuel that comes with GM. It has all sort of helpful information like that :D (sarcasm 0%)
Create a New Page
Top 10
Top 50
Read the manuel that comes with GM. It has all sort of helpful information like that :D (sarcasm 0%)
Haha, perfect. I didn't even realize vk_shift existed. Thanks.
hartnell i will add these to platforming section
@
Shifty:
You don't need to use the keyboard_check_direct() function; I found out that keyboard_check_pressed() and keyboard_check_released() work perfectly well also with the SHIFT keys (as long as you don't care to distinguish between LEFT and RIGHT SHIFT — i.e. use the vk_shift constant). I didn't check the keyboard_check() function per se, but I'd be surprised if that wouldn't work (considering its "sibblings" DO work)…
I hope that works for you and I am happy that I was able to at least give you a different perspective on which to approach the subject. Let me know if that works out. If it doesn't let us know what event it is being placed in and what code is being run and we can try to debug it further if need be.
Doing this may actually work for me.
So far my code is like this;
I have a variable menu_select that is set to 0 when nothing on the menu is selected, and is set to a designated number (each option is assigned a number) when something is selected. So, when menu_select is set to 0, nothing happens when you click. If it is set to any other number, that action is performed where you click, and then this code which resets menu_select to zero except when a shift key is currently pressed (or at least, that's what I'd like it to do).
//if either shift is not currently down, menu_select resets if (!keyboard_check_direct(vk_lshift) && !keyboard_check_direct(vk_rshift)) menu_select = 0;
What I meant when I say it's acting like keyboard_check_pressed() is that when I hold shift, it works correctly, but when I let go, it will perform one more click than I want it to before it resets menu_select to zero. In other words, it's not checking if it's currently down (like keyboard_check() does), it's checking if it was pressed since the last step. Does that make any sense?
The code you suggested might fix that, though, by adding another layer to the check. I'll try it.
I am not sure if this will help you any but it sounds like you are changing something to a different state but not changing it back when the shift key is no longer pressed.
For example:
if keyboard_check_direct(vk_shift)
then
pressed_shift = true;// change state of pressed_shift to true
else
pressed_shift = false;// if I do not put this else statement the variable pressed_shift remains true
//even when the shift key is no longer being pressed.
I apologize if this was way off base.
Though there is a lot of good advice here on game design that you may want to think about, I would suggest trying a global left mouse event to see if that helps any.

though there are various means for solving any problem, the initial question was whether there was a draw function that drew an arrow that wouldn't interfere with the place_empty function. If you are merely looking for a simple arrow to point in a direction that wont interfere may I suggest the draw_arrow function?
draw_arrow(x,y,oexit.x,oexit.y,12);//arrow points to exit and size of arrow head in pixels is 12
//which can be changed
Another option, if one prefers to be more elaborate on one's arrow, would be the draw_background function. This would require a background image for each of the directions you want the arrow to point.
And then there is the let's draw it all method. In this instance I would suggest researching draw_rectangle and draw_triangle.
I hope one of these helps.
You could try making the mask for the arrow object a blank sprite.
Also, in the collision checking code, I'm pretty sure you can choose whether to check for all instances or only solids. I know that sometimes the check needs to be for all instances (you would rarely mark the player object as a solid), so this might not help.
place_empty i think is already checking for non-solid and solid. place_free is for solid only. Since the code is using place_empty, ANYTHING is going to count.
Sooo… who wants to do a pain in the butt test? (i'm at work and don't have time)
What would happen if you draw the arrow on a surface, and then draw the surface? Will it still cause a collision?
Well, if I, for one, am playing an online game or something, one of those simple ones that entertains me for a little, that maybe I come back to the next day, but only for mild entertainment, one that I put down after I'm done and never go back to again, and say "that was clever," but after the first run I'm satisfied and I don't feel any urge or pull to go back to the game any time soon, perhaps in the far future when I'm bored again, then I really don't care if there isn't more than one save slot.
That was a huge run-on sentence.
If your game is on that level, I wouldn't worry about it too much.
On the other hand, details do matter. Adding more slots would add a lot to the game, and if it's not too much trouble, do it.
I have an idea for this (and I don't see how rounding or integer division have anything to do with it):
Make a separate variable that holds the next "threshold". For example, at the start of the game, set var_super_threshold to 50,000. Then, have a function that does this:
if (var_points >= var_super_threshold) //in other words, when the score reaches the threshold (which is initially 50000) { var_super_threshold =+ 50000; //this adds 50000 to the current value of the variable special_move = true; }
This way, the separate variable is able to increase in increments of 50000 every time it is reached by the score. Sound good?
keyboard_check() checks to see if a key is currently down.
keyboard_check_pressed() checks to see if the key was pressed since the last step.
Now, I understand these. For what I'm doing, I want to use keyboard_check(). It's for a sim-city-like game, and I want the user to be able to build multiple instances of the same object on the map, without having to go back and click on the menu, by holding down 'shift' and clicking multiple times.
Now, in order to check the shift key, you have to use keyboard_check_direct(). This is my problem. When I use it, it behaves like keyboard_check_pressed(), and there's no other option if I want to check the shift key. I'm being stubborn and I want to use the shift key because that's the most common key for that type of function in a game.
(?!?!? That's a weird thing to ask…)
newguy: I don't understand who would spend so much time to write all the code on the Internet for other ?
Your question implies there's only one person doing all that… I'm sure you realize that is ridiculous. More likely there are billions out there ! ;-)
People generally like to share stuff, rather than keeping it locked away; so if someone thinks of a neat way to do something, it is quite likely that someone would like to show others what he/she did and how (if not for education alone, then for braggin').
newguy: Where did the information[s] come from ?
From people, obviously; many, many, many of them… ;-)
@NicAdi: Maybe because he wants it to point to the exit without having to draw a new sprite for every direction?
Anyways, is the arrow solid? If it is, uncheck the solid box and it should work. If its not solid, then I dont know whats wrong. Maybe you gave it a parent that is solid?
@
kake_fisk: And how is that supposed to help, Kake?
Kevin: I want to make an arrow that points to the exit […] The arrow is just supposed to be a guide that directs the player to the finish, not anything that gets in the way.
Why can't you draw the arrow as a background (either a full background picture, or just a tile placed where needed) (i.e. part of the room layout)?
someone messed with my computer and now it says that the file is corrupted, how do I fix this??????
also in trying to recreate the game it says that there is not enough storage to do anything even though there are 14 gigs of space left in the drive(it shows error code 80000004).
EDIT: sorry about that I freaked out, but it is fixed now, the problem was that the person deleted part of the gamemaker program (the actions) so it read the files as corrupted, it is fixed now.
any way can you guys figure out what is wrong with the above code(in block).
I was wondering that. Example : the GML code.
A lot of people here know a lot of code and said like : I found it accidentally on the Internet or My friends find it out on Internet…
I don't understand who would spend so much time to write all the code on the Internet for other ?
That's an example. Where did the informations come from ?
You can check if it is a collision with collision_line().
if (collision_line(x,y,oexit.x,oexit.y,all,false,true)) { //There is something in the way }