in discussion The Community / Game Maker Help » Replacing a variable name throughout your entire game
Could you not just in maybe the step event of on object use the code
//insert new code old_var = new_var
Create a New Page
Top 10
Top 50
Could you not just in maybe the step event of on object use the code
//insert new code old_var = new_var
Can you upload the file?
Of course you need to keep track, one way or another, of the items collected. But it seems to me rather awkward to do that for each and every item (i.e. on the "things" side). It makes more sense to have an inventory variable on the Player/Character side; since usually inventories have limited slots (i.e. the Player can carry just a few "things", while there could be many, many more in the whole game), this looks like a better, more economical way to do it.
Hoo-bleedin-rah: got it!
Just gonna explain quickly in case anyone else needs this, as it was a nightmare to find any help on.
Paths cannot be moved while there is an instance following them.
After assigning path(in Create event):
CREATE EVENT
//create variable for old position pos = path_position //take object off path path_end(); //move path to view path_shift(path0, 0, view_yview) //put object back on path, absolute = true path_start(path0,1,0,true); //move along path a bit path_position = pos + 0.004;
STEP EVENT
pos = path_position path_end(); //move path with view (in this case, y -1) path_shift(path0, 0, -1) //put object back on path path_start(path0,1,0,true); //move a bit path_position = pos + 0.004;
Hope this helps other people. gawd knows i struggled with it.
Thanks, found a method called path_shift() that is supposed to move the path, but I have no idea of the syntax, and can't seem to find anywhere that explains it. Can anyone help?
try checking the the game maker manuel (that comes with game maker)
I realise I could edit the path points to compensate, but the path has circles, and it'll take forever to get it right. Just looking for an easier way!
Hi,
I'm working on a project which uses a view, which moves from the bottom of the room to the top.
It needs to have an object follow a path, left to right across the view. The path is working, however because the view is moving up, it causes the object to appear to shift downwards, instead of staying at the view's vertical position.
I've tried moving the object itself up every frame (both with 'jump to position' and 'set vertical speed'), which has no effect. Not sure what else to try.
Is there any way to move the path with the view? I'm using GM Pro.
Thanks,
Simon.
Hey, ma names Ryan and i am a student. I am working on a course at the moment and i need to create a game. The problem i am having is that after deciding to create a missile defence game, the turret doesn't work correctly.
I followed this tutorial, because it is 99% similar to what i want.http://gamemaker.wikicomplete.info/helprequest:how-do-you-make-the-mouse-act-as-point. I want to be able to have a turret that follows the mouse in a 90 degree angle and stop past that, after following this tutorial, it works however, if i go past 90 degrees its flicks back to the original frame.
Sorry if it isn't explained very well but i quite literally started game making about 2/4 weeks ago :P
Thanks. Ryan.
Currently I'm making the lesser enemy sprites (i.e. non-boss enemies). I'm gonna be away during Thanksgiving week, in a place that's kinda in the sticks (and thus internet access is at a crawl). So don't fret if you don't hear from me.
What exactly are you trying to accomplish? Just a simple jump? double jumps? Are you having problems making the character jump or is it having them come down or is it stopping when the character hits the ground?
I don't see how you could do it without some variable telling it whether an item was picked up or not. I mean if you have an item picked up then you don't want to pick it up again when you click the pickup/drop action you want it to drop the item not pick it up again. If you can think of a way to do it without the variable the please tell me, I would like to know how else you could do it.
hello i had recent geek aspirations so i began reading some articles on coding in basic. i was talking to my friend during lunch and he reffered this to me. and here i am. i dream of creating a cross-referencing database to determine the statistically best hockey players of all time. or create a computerized judicial system
That's definately something that I'm gonna fix. The whole view movement system will be completely revamped…
Just remember that this is my first game, so I'm using the lite edition.
The view moves down when you hover the mouse over the HUD. I found that extremely annoying.
Yeah and if you want a double jump effect you can use a variable to an effect of:
In the create event:
jumps = however many jumps you want to be able to do
jumpable = jumps
In the jump event:
if jumpable < jumps +1
-do the code for jump-
jumpable -=1
In the collision with ground event:
jumpable = jumps
I used this in a couple of games each with a different means of jumping but in all of them I was able to limit the number of jumps until the player hit the floor.
Be wary, though you have to make the ground object different from say a wall or ceiling. other wise you will have to find out which side of it you are hitting and that can take awhile, I find.
Sir_Willard: […] shouldn't some kind of tolerance be added to the code | if (direction == point_direction(x, y, OPlayer.x, y))
No, it shouldn't. I know what you're talking about, but that's not the case here. The main reason is that this particular game is some sort of platformer (as suggested by a statement made in a previous post that the Enemy units can only move LEFT or RIGHT), thus direction can only be either 0o or 180o. That takes care of one side of the identity; as for the other, you may notice that I have used __the same value (i.e. y) for the two 'y' coordinates required. This guarantees the vector whose direction is being evaluated is horizontal, thus its direction, again, can only be either 0o or 180o.
In conclusion, additional tolerances are not required simply because there are no "rogue" values that can be produced on either side of the identity.
Recen;ty I have been working on battle grounds. It is an RTS…but it definately is unique. Hartnell might recognize this project. Anyway. I just released prototype V0.4 and was looking for some pointers. More information about the game and a download link can be found here.
Just to wet your appatite:

Not to jump into this at the very end and nitpick the code, but shouldn't some kind of tolerance be added to the code
if (direction == point_direction(x, y, OPlayer.x, y))
from my experience, this fails a good amount of the time, since the direction isn't rounded. You have to be pixel for pixel lined up in that direction for this code to work consistently.
Of course, I've been out of this for a while. Just an observation.