I did this in another room that was the default 480x270 game size not scrolling in order to test it out
It is setting a laser beam object in middle of room bottom part of screen and then moving it though the middle of room on mouse left click.
this works except I need to figure out how to do the part you were helping me with on the finding that middle and keeping it there when the room is scrolling room.
if (mouse.IsButtonDown(eMouseLeft) && phaser1_onscreen==false){
object[0].Visible=true; //laser beam
object[0].Move(220 , 0, 5, eNoBlock, eAnywhere); //laser beam
SetTimer(3, 50); //timer to give laser beam enough time to move off screen
phaser1_onscreen=true; //Book to say the laser is on screen
}
else if (mouse.IsButtonDown(eMouseLeft) && phaser1_onscreen==true) {
}
if (IsTimerExpired(3)) {
object[0].Visible=false; //Hide the laser Laser Beam
object[0].SetPosition(220, 267); // Reset Laser Beam Location at Bottom
phaser1_onscreen=false; //reset bool that laser beam is no longer moving on screen
}
This works fine in a non scrolling room now I have to figure out how to edit it to working in the scrolling room with the
instructions you gave me for finding the viewport location.
And I understand what your code means and is supposed to do I am still to dumb to write it out as I still get confused on the whole room vs viewport locations and such.
center x coordinate is GetViewportX() + Screen.ViewportWidth / 2
But will the code work for what I am looking for. The way I have it set up if i can get it to hide at the center bottom of the gui overlay I have will work for me to be able to add in all my random, damage, repairs and such and test out a lot of my other stuff and take a big step forward.