How to series - 'In Game Shop'

Index

Stats

6,595 visits, 21,019 views

Tools

Now we'll play with the game layout, and event sheet

On the game layout add a sprite for the player, some ground and a level complete sprite. I'm simply using colored boxes.

- Give the player the platform behavior.

- Give the ground a solid behavior.

- Feel free to add anything you want to the game.

- you can add a scroll to behavior to the player if you want to, but im going to show you how to do this through the event sheet.

This is how mine looks:

Lets add some code :D

- Im going to quickly show you how to scroll to the player without using the scroll to behavior. This can be usefull if you need to show a little bit ahead of the players position ect.

So open your game layout and event sheet, and drop this code in:

     System.EveryTick
        -> System.scrollToPosition(Player.X, Player.Y)

simples right? :D

Should look a little like this:

Lets Save those variables

- sorry i forgot to show you how to save those variables before we give them to the player.

Go back to the shop layout and add another button, name it 'GoToGame' or something appropriate.

Now add this event:

     GoToGame.OnClick
          -> Webstorage.setLocalKey("SavedMoney" to Money) // Here were naming a local key 'SavedMoney' <- this can be what ever you want, and were giving the local key a value of Money, The variable we have 
          -> Webstorage.setLocalKey("SavedSpeed" to PlayerSpeed) // saving speed
          -> Webstorage.setLocalKey("SavedArmor" to PlayerArmor) // saving armor
          -> Webstorage.setLocalKey("SavedJumo" to MaxJump) // saving max jump
 

This is how it should look:

Now we can apply these saved values to the player :D

So we need a system on start of layout event.

Thats it for the tutorial my PC keeps crashing on me, So please just take a look at the capx and PM me or comment if you need any help :) Thanks.

  • 0 Comments

  • Order by
Want to leave a comment? Login or Register an account!