RMRK is retiring.
Server is paid up for the rest of 2026, but the forum may go after that. See here for more information. Please archive or save anything you would like to keep before 2027.
Main Menu
  • Welcome to The RPG Maker Resource Kit.

Change Picture Angle?

Started by Tenraah, August 15, 2010, 02:37:37 AM

0 Members and 1 Guest are viewing this topic.

Tenraah

Anyone know what the script is to set a picture's angle in RMXP?
I made a time-of-day deal in my game with a working digital clock in the menu, but I was thinking of how cool it would be to have a working analog clock, or a clock tower somewhere.  I noticed looking around in Game_Picture that it looks like you might be able to set a picture's angle without it being set to rotate.  I have some basic scripting knowledge so I don't know how I'd make that happen.  I searched at rmrk.net and hbgames.org with out any help.
"...because, you know, whatever."

cozziekuns

I haven't toyed around with RPG Maker XP for a while, but something like $game_screen.pictures[picture number].angle = angle in degrees, in a script call should work.

Tenraah

Error  :(
"NoMethodError occurred while running script.
undefined method 'angle=' for #<Game_Picture:0x2725168>"
I've tried messing with a bunch of variations on that with no success, too.
"...because, you know, whatever."

cozziekuns

Ah, my bad. Go to Game_Picture and change the line "attr_reader :angle" to "attr_accessor :angle"

Tenraah

It works!     :D
Now I just have to whip up some art and make the event...
Thanks again!
"...because, you know, whatever."

Tenraah

#5
Allright... I'm trying to make the event to make a clock now, but I'm stuck.
Can you tell me why this doesn't work?
hour = $game_variables[155] / 60 % 60
min = $game_variables[155] % 60
if hour >= 12
  hour = hour - 12
end
hour = sprintf("%2d", hour)
min = sprintf("%2d", min)
$game_screen.pictures[3].angle = hour
* 20
$game_screen.pictures[4].angle = min
* 6

Just brings up the error "SyntaxError occurred while running script."
$game_variables[155] is the variable I used to track the time.  Counts up 1 every 20 frames, resets to 0 at 1440.
I'm trying to learn  :)

Edit: After messing around with this for a few hours, it seems like the other scripts involved in showing pictures can't read that sprintf stuff... guess I'd have to make a million conditional branches in an event to make it work this way then :(
"...because, you know, whatever."

Nhoj_yeR

hour = sprintf("%2d", hour)
min = sprintf("%2d", min)

remove these lines and it will be fine. ;)
these lines make the hour and min variables strings but you need integers for angle.