How to get a core tied down to the camera position?

Started by Clean0nion, January 31, 2014, 01:51:50 PM

Previous topic - Next topic

Clean0nion

Essentially, I'm looking for what TRUE SetScreenMode does, but without using it.

So what I want to do is have a core follow the camera around. Here's what I have so far:

ScreenWidth GetCameraPosition swap pop add Self CONST_PIXELCOORDX SetUnitAttribute
ScreenHeight GetCameraPosition pop add Self CONST_PIXELCOORDY SetUnitAttribute


I also do want it to be affected by zooming - so is there any way I can detect a zoom level?

I'm aware that my requests seem strange and unnecessary. But if anyone can help me, I'd be very grateful.

EDIT: My current code does nothing.

knucracker


GetCameraPosition ->cy ->cx
SetUnitAttribute(Self CONST_PIXELCOORDX <-cx)
SetUnitAttribute(Self CONST_PIXELCOORDY <-cy)


Make sure to unpause the game.  This puts the tower square in the middle of the screen and keeps it there.

Clean0nion

#2
Quote from: virgilw on January 31, 2014, 02:58:43 PM

GetCameraPosition ->cy ->cx
SetUnitAttribute(Self CONST_PIXELCOORDX <-cx)
SetUnitAttribute(Self CONST_PIXELCOORDY <-cy)


Make sure to unpause the game.  This puts the tower square in the middle of the screen and keeps it there.
Thank you very much! This is pretty much exactly what I was looking for.

UPDATE: Modified to match my intention - this is perfect.