kopia lustrzana https://github.com/backface/turtlestitch
				
				
				
			Nested Sprite Rotation
							rodzic
							
								
									9bbd379528
								
							
						
					
					
						commit
						289dd6b2e6
					
				|  | @ -1862,3 +1862,4 @@ ______ | |||
| 130808 | ||||
| ------ | ||||
| * Objects: Nested Sprite Scaling | ||||
| * Objects: Nested Sprite Rotation | ||||
|  |  | |||
							
								
								
									
										15
									
								
								objects.js
								
								
								
								
							
							
						
						
									
										15
									
								
								objects.js
								
								
								
								
							|  | @ -2693,11 +2693,22 @@ SpriteMorph.prototype.forward = function (steps) { | |||
| 
 | ||||
| SpriteMorph.prototype.setHeading = function (degrees) { | ||||
|     var x = this.xPosition(), | ||||
|         y = this.yPosition(); | ||||
|         y = this.yPosition(), | ||||
|         turn = degrees - this.heading; | ||||
| 
 | ||||
|     // apply to myself
 | ||||
|     this.changed(); | ||||
|     SpriteMorph.uber.setHeading.call(this, degrees); | ||||
|     this.silentGotoXY(x, y); | ||||
|     this.silentGotoXY(x, y, true); // just me
 | ||||
|     this.positionTalkBubble(); | ||||
| 
 | ||||
|     // propagate to my parts
 | ||||
|     this.parts.forEach(function (part) { | ||||
|         var pos = new Point(part.xPosition(), part.yPosition()), | ||||
|             trg = pos.rotateBy(radians(turn), new Point(x, y)); | ||||
|         part.turn(turn); | ||||
|         part.gotoXY(trg.x, trg.y); | ||||
|     }); | ||||
| }; | ||||
| 
 | ||||
| SpriteMorph.prototype.faceToXY = function (x, y) { | ||||
|  |  | |||
		Ładowanie…
	
		Reference in New Issue
	
	 jmoenig
						jmoenig