![]() I fixed this by adding the 'pointinrectangle' code to the 'Draw GUI' event instead of the 'Step' event. If the value is less than 200, the player object will create an instance of "obj_Missile". SOLVED So the problem ended up being that I was checking if the mousex and mousey was between coords relative to the world, when I really needed the coords relative to the GUI. The above code will get the x and y coordinates of the nearest enemy and then use them to check the distance (length) of the vector formed by them and the player coordinates. I'm trying to get the mouse positions in the view, I already tried windowgetx, and windowviewmousex, but all it returns is the value of the mouse in the room, not the view, how can I be picking up the mouse position in the View and not in the room. ![]() mousex however will only return integers from 0 to 10 in that example, despite there being 1000 units of granularity on screen so my script determines its 'real' room position with a bit of math. if you have a window that's 1000 pixels wide, showing a zoomed in room just 10 pixels wide, then 1 room 'pixel' is going to be 100 window-pixels wide. Instance_create_layer(x, y, "Bullets", obj_Missile) The mouse does move by fractional pixels when in room-coordinate, though that's what I'm trying to capture. The y coordinate of the second component of the vector The x coordinate of the second component of the vector The mouse position is provided in physical/ unscaled Windows pixels and in coordinates scaled by DPI-virtualization. MPos especially considers High-DPI monitors and DPI scaling of Windows 10. The y coordinate of the first component of the vector Code MPos is a minimalistic and easy to use tool to track the current position of the cursor on the screen. The x coordinate of the first component of the vector ![]() ![]() For example, in the image below if we want to get the distance between the player ship position and the enemy position so that we can calculate if the enemy is close enough to shoot at then we would use this function (the exact code is in the example below the image): This function returns the length of a vector formed by the specified components and. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |