Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Tap RPG Questions
Started by ragingconsolerc Jun 30 2018 11:01 PM

2 replies to this topic
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

ragingconsolerc

[GLOBAL: userInfoPane.html]
ragingconsolerc
  • Observer

  • 18 posts
  • Corona SDK

So I've been working on a "Tap RPG" app or what some may call a Gacha game.

 

I was wondering how to do 2 things.

-I do use robmiracles simple save and load function

1. Is changing an image from scenes.

For example on my main screen Ill have an image of a monster then i'll go into my team scene and click on a monster and after exiting that scene whichever monster I clicked on would appear on my main screen and remove the other monsters.

menu->team->menu with new monster 

 

What I believe I have to do is create a table with all the monsters I have on my team and when one is clicked be saved into a JSON file. And have that JSON file save it and when going back to the main menu screen it read/loads the JSON into displaying the new image.

 

2. Adding images to scroll view

So after my player collects a new item i want the item to display on bottom of the item on top of it.

I do have it so the number of items is saved, but my only problem is adding the image onto the bottom so it can continuously/automatically keep going 



[TOPIC: post.html]
#2

ldurniat

[GLOBAL: userInfoPane.html]
ldurniat
  • Contributor

  • 325 posts
  • Corona SDK

1.

 

A. Pass custom data that should be transferred to the scene.

 

Example from documentation

--------------------------
-- From "scene1.lua"
--------------------------
local customParams = {
    var1 = "Hello ",
    var2 = "World!"
}
composer.gotoScene( "scene2", { effect="fade", time=800, params=customParams } )


--------------------------
-- In "scene2.lua"
--------------------------
local composer = require( "composer" )
local scene = composer.newScene()


function scene:create( event )
    print( event.params.var1 .. event.params.var2 )
end
scene:addEventListener( "create" )

See more:

B. Use new feature of Composer to Setting/Getting Variables from another Composer scene.

 

To set variable playerName use 

composer.setVariable( "playerName", "Zorron" )

To retrieve the variable from another scene use

local playerName = composer.getVariable( "playerName" )

See more:

 

ldurniat


Edited by ldurniat, 01 July 2018 - 12:42 PM.


[TOPIC: post.html]
#3

ragingconsolerc

[GLOBAL: userInfoPane.html]
ragingconsolerc
  • Observer

  • 18 posts
  • Corona SDK

Oh I understand ! I actually did not know about the new feature Corona implemented ! Will take a look on that before deciding which is more convenient 




[topic_controls]
[/topic_controls]