Positioning character further down screen [SOLVED]

Started by the Mask dot Bitmap, Thu 07/01/2021 18:11:09

Previous topic - Next topic

the Mask dot Bitmap

This one room, the room graphic is larger than 320x200, the entire room is walkable

and I want the character to display at the bottom of the screen ( say at like y 185) while he scrolls around the room.

default is that he's somewhere in the middle.

here's an illustration of my problem:


Best I could come up with was that i need to repeatedly tell the program to push the viewport up the y axis, but I can't seem to wrap my head around how viewports work
even after reading this https://adventuregamestudio.github.io/ags-manual/UpgradeTo35.html

Thanks in advance for any help.

Khris

#1
Edit: got it.

You need to set the camera coordinates in the room's repeatedly_execute event (or late_repeatedly_execute_always).
Something like
Code: ags
  Game.Camera.SetAt(player.x - 160, player.y - 185);


edit: code fixed

the Mask dot Bitmap

Quote from: Khris on Thu 07/01/2021 18:13:52
Edit: got it.

You need to set the camera coordinates in the room's repeatedly_execute event (or late_repeatedly_execute_always).
Something like
Code: ags
  Camera.SetAt(player.x - 160, player.y - 185);


Thanks for helping.
I get this error when trying to run:
room25.asc(37): Error (line 37): must have an instance of the struct to access a non-static member

I've read about structs... I don't quite get it.

Crimson Wizard

It should be Game.Camera.SetAt. Game.Camera is an instance of camera contained in Game struct. Just "Camera" is a type of object.

the Mask dot Bitmap

Quote from: Crimson Wizard on Thu 07/01/2021 18:51:56
It should be Game.Camera.SetAt. Game.Camera is an instance of camera contained in Game struct. Just "Camera" is a type of object.

Thanks, that worked!

the character was vibrating a lot, so I moved it into late_repeatedly_execute_always.


SMF spam blocked by CleanTalk