Sign in to follow this  
Red Cloud

Game Maker help (need an object to stay on same point as the screen as it moves)

Recommended Posts

Hi all. I've got a little query I'd like to see if somebody can help me with. I'm not new to these forums or Game Maker (even though it is a very simple program), but I haven't touched on either in a while. I'm making a simple theme park game, and I have a menu that appears when you click on a building site to choose what you wish to build. I want the menu to stay on the screen even when you move the screen by moving the mouse to the edges of the screen. Now, drawing objects stay nice and still and work perfectly with the "view_xview" and "view_yview" command, but doing the same with an object isn't as effective. I want the icons as objects in the menu, but when the screen moves, the objects only loosely follow their position. By that, I mean, as you move the screen, it is as though the object isn't paying attention and catches up later on, so it doesn't look very good at all. Anybody have a suggestion that should keep objects still on a movable screen?

Share this post


Link to post
Share on other sites
First, I assume you are using the step event to update the object's position according to the view port.

I've used Gamemaker extensively and my impression is that the "step" event is not called every loop iteration, but rather according to some schedule. The "draw" event might be, but I'm not sure. Have you tried updating the position during the draw event?

Share this post


Link to post
Share on other sites
I am using the step event, yes.

Thanks for the help, I made a new object which is a control for all these icons to click on which are objects. As soon as you make a draw event for an object it becomes invisible for some reason, so thanks to your help I made a new object which is a control for all the icons that will be appearing, and placing them in the draw event does the trick. Thanks a lot guys! :)

Share this post


Link to post
Share on other sites
Sorry, I forgot; When you define the object's draw event, you override the default draw event, which is what draws the sprite. You'd have to put in a sprite drawing function in the draw event.

In your first you'd written that you had tried this and it drew the menu elements correctly? Why was that not adequate?

Share this post


Link to post
Share on other sites
Quote:
Original post by Kelly G
Sorry, I forgot; When you define the object's draw event, you override the default draw event, which is what draws the sprite. You'd have to put in a sprite drawing function in the draw event.

In your first you'd written that you had tried this and it drew the menu elements correctly? Why was that not adequate?


Sorry, I meant that drawing sprites (not objects) works correctly in the draw even, but when it comes time to drawing objects and keeping them still in the view, it isn't as effective, because I wasn't aware that you could make it jump to a position using the draw command, I always used the step command. But not that I can use the draw command it works perfectly.

PS. I always wondered why the sprite disappeared when I made that object have a draw command. Now I know why, and it should solve all my problems I've been having with those. Thanks a bunch! :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this