Skip to content

Commit

Permalink
Refactored SceneStartAction to kotlin
Browse files Browse the repository at this point in the history
  • Loading branch information
PratyushSingh07 authored and dorianpercic committed Jul 25, 2023
1 parent 56e8dcb commit f33f8f4
Showing 1 changed file with 28 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,37 +20,32 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.catrobat.catroid.content.actions;

import com.badlogic.gdx.scenes.scene2d.actions.TemporalAction;

import org.catrobat.catroid.content.Sprite;
import org.catrobat.catroid.stage.StageActivity;

public class SceneStartAction extends TemporalAction {

private String sceneName;
private Sprite sprite;

@Override
protected void update(float percent) {
if (sceneName != null) {
sprite.releaseAllPointers();
StageActivity.stageListener.startScene(sceneName);
}
}

@Override
public void reset() {
super.reset();
sceneName = null;
}

public void setScene(String sceneName) {
this.sceneName = sceneName;
}

public void setSprite(Sprite sprite) {
this.sprite = sprite;
}
package org.catrobat.catroid.content.actions

import com.badlogic.gdx.scenes.scene2d.actions.TemporalAction
import org.catrobat.catroid.content.Sprite
import org.catrobat.catroid.stage.StageActivity

class SceneStartAction : TemporalAction() {
private var sceneName: String? = null
private lateinit var sprite: Sprite
override fun update(percent: Float) {
if (sceneName != null) {
sprite.releaseAllPointers()
StageActivity.stageListener.startScene(sceneName)
}
}

override fun reset() {
super.reset()
sceneName = null
}

fun setScene(sceneName: String?) {
this.sceneName = sceneName
}

fun setSprite(sprite: Sprite) {
this.sprite = sprite
}
}

0 comments on commit f33f8f4

Please sign in to comment.