Be a Supporter!

Help with code for Room Layout

  • 256 Views
  • 2 Replies
New Topic Respond to this Topic
Toocool100
Toocool100
  • Member since: Oct. 5, 2002
  • Offline.
Forum Stats
Member
Level 60
Melancholy
Help with code for Room Layout 2011-01-08 18:31:27 Reply

Back in college i made a flash that allowed me to move around shapes (my furniture, that was measured) around a grid (to the exact size of my dorm) to see what would be the best layout for all my stuff.

I need to remake this in flash, except this time it needs to be more advanced and i need help.

I had made the shapes of the furniture buttons that i could click and drag where i wanted, but now i need the following addition:

I would like to be able to rotate the objects into any position (360 degree's around). or at least rotate them into the four 90 degree positions.

Is there a code or procedure i can use for this? Thank you


Every once in very great while comes a ridiculously funny thread. So funny in fact i must put it into my sig http://www.newgrounds.com/bbs/topic /1049194/1

Jaface
Jaface
  • Member since: Aug. 26, 2010
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Response to Help with code for Room Layout 2011-01-08 18:36:48 Reply

To rotate a movieclip named "mc" 90 degrees:

AS2:
mc._rotation = 90;

AS3:
mc.rotation = 90;

sandwich-eater
sandwich-eater
  • Member since: Aug. 14, 2009
  • Offline.
Forum Stats
Member
Level 41
Programmer
Response to Help with code for Room Layout 2011-01-08 18:42:54 Reply

Make each object a movieclip, put the dragging code on it.
Then make a button inside the movieclip (which you click to rotate the main mc)
code on it:

on(Press){
_parent._rotation +=90
}

You put that same button inside each movieclip.
This is of course only rotatable 90 degrees, but you can change it. It'll just take longer to rotate.


BBS Signature