'From Cuis 5.0 of 7 November 2016 [latest update: #3043] on 30 January 2017 at 6:16:24 pm'! !classDefinition: #Tokenish category: #'Game-Graphics'! EllipseMorph subclass: #Tokenish instanceVariableNames: '' classVariableNames: 'HopVComponent' poolDictionaries: '' category: 'Game-Graphics'! !Tokenish commentStamp: '' prior: 0! A player's piece on the game board.! !Tokenish methodsFor: 'stepping' stamp: 'dhn 1/30/2017 18:07:59'! jump "Make the receiver hop" | step limit i hop horiz | step _ 4. "time of each increment of the hop" hop _ self class hopVComponent. limit _ 1000000. "hack" horiz _ 0. "hack" i _ 0. self when: #morphicStep evaluate: [ :delta | i _ i + 1. i < limit ifTrue: [self morphPosition: (self morphPosition translatedBy: horiz@(hop atWrap: i))] ifFalse: [ self stopStepping. self triggerEvent: #jumped. self removeActionsForEvent: #morphicStep]]. self startSteppingStepTime: step. ! ! "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! !classDefinition: 'Tokenish class' category: #'Game-Graphics'! Tokenish class instanceVariableNames: ''! !Tokenish class methodsFor: 'instance creation' stamp: 'dhn 1/30/2017 17:53:15'! setupHop "Answer the vertical component of a jump" | col up | up _ OrderedCollection new. col _ OrderedCollection new. 0 to: 45 do: [:i | up add: ((i * 2) degreesToRadians cos * 2) negated]. col _ col addAll: up; yourself. col _ col addAll: up reversed negated; yourself. ^ col! ! !Tokenish class methodsFor: 'instance creation' stamp: 'dhn 1/30/2017 18:13:49'! start ^ (self new openInHand) jump! ! !Tokenish class methodsFor: 'operation' stamp: 'dhn 1/30/2017 17:53:15'! hopVComponent "Answer the value of HopVComponent" HopVComponent ifNil: [HopVComponent _ self setupHop]. ^ HopVComponent! !