RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Change Picture Angle?

0 Members and 1 Guest are viewing this topic.

***
Rep:
Level 89
I have attention problems.
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."

*****
Rep:
Level 84
This text is way too personal.
Bronze - GIAW 11 (Hard)Silver - GIAW Halloween
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.

***
Rep:
Level 89
I have attention problems.
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."

*****
Rep:
Level 84
This text is way too personal.
Bronze - GIAW 11 (Hard)Silver - GIAW Halloween
Ah, my bad. Go to Game_Picture and change the line "attr_reader :angle" to "attr_accessor :angle"

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

***
Rep:
Level 89
I have attention problems.
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?
Code: [Select]
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 :(
« Last Edit: August 15, 2010, 06:32:14 AM by Tenraah »
"...because, you know, whatever."

**
Rep: +0/-0Level 82
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.