DnD: New question camera related

MMGames

Member
The original question was answered sucessfully, but now I have another doubt. I am adding a new post in this thread to ask for help.

How can I move the camera over the map pressing keys?
Basically, I have a room that is really big, then I have a small camera on it. I want the camera to move around the room as I press the arrow keys. How can I do this?
I am using DnD version.

I tried with this but it didn't work properly...

movecamera.jpg

Thanks a lot!

-----
Hi all,

I'm trying to develop a platformer.
The idea is that in the top left corner you will get to see a sprite with the number of diamonds you have. Or the life, or the level, whatever. For the moment I am working with diamonds (collectable items). But of course this is a platformer, the character (a ball righ tnow) will be moving around, and so the viewport/camera will. Being like that, I want the diamonds to be shown always in the same spot, following with the camera (like in any platformer).

My idea was to create an object that will be running through the level, and in its step event will remove the previous diamond sprite and paint it again based on the new camera location.
Unfortunately I wasn't able to get the Viewport or Camera information. I tried using several functions and different ways, painting it in the step event, in the draw event, etc.
In the end, I found the function that I believe would give me the information I need:
camera_get_view_x(0)
camera_get_view_y(0)
But no matther how many times I trie, the value for the X and Y coords is always 0, so of course the diamonds are painted in the 0,0 coords and don't show in the camera.

error1.jpg
error2.jpg

Can anyone see what am I doing wrong?
I think maybe the ID name of the camera is not "0", and that's why the value gets always to "0". But I can't change the camera name anywhere in the properties tab, neither is there a DnD object to change it.
camera_get_view_x(what should this ID be?)
camera_get_view_y(what should this ID be?)

Or am I completely wrong?
Thanks a lot.
 
Last edited:

MMGames

Member
OMG Thank you! You just saved my life!
Thanks a lot, I was about to drop all the project because of this nightmare. It's not intuitive at all, and the worst thing is I didn't find this information anywhere.
Thanks again!

cameraworks.jpg
 
The other thing to do is to have the crystal draw itself in the Draw GUI Event instead of the Draw Event, as the Draw GUI ignores the camera and draws directly to the pixels on the screen (so something drawn at x:10,y:10 in the Draw GUI will ALWAYS be at x:10,y:10 on the game screen without having to adjust for camera position).
 

MMGames

Member
The original question was answered sucessfully, but now I have another doubt. I am adding a new post in this thread to ask for help.

How can I move the camera over the map pressing keys?
Basically, I have a room that is really big, then I have a small camera on it. I want the camera to move around the room as I press the arrow keys. How can I do this?
I am using DnD version.

I tried with this but it didn't work properly...

movecamera.jpg

Thanks a lot!
 
Top