Android Question randomly apear 6 line of text in page with drag & drop capabilty

jili jons

New Member
hi,
i want to create an game app in b4a. the app have 100 files in each of them 6 paragraph of text. when player start the game, application randomly choose one of the 100 files and show randomly its content (6 paragraph from 1 to 6 for example : line 1, line 6, line 4,e line 3, line 2, line 5) then player change the order of lines by drag & drop. finally the app compare player ordered list with own sample and gave score to player. how can i code this steps?
 

QtechLab

Active Member
Licensed User
Longtime User
Hi,

Name the files with a sequential name ex. file_1, file_2, file_3, file_4, file_5, etc..
Open the file by adding the prefix of the name "file_" to a Random value between 1 and your max file number.
The function "readline" gives you a list of string, each string is a line of your text file.
Show the list content in any graphic way that you can control with gesture and check them with an array of "position" (that is your solution).
 
Upvote 0

jili jons

New Member
thank you for answer. could you explane by example? for example if we have names of months: January , February, march ... in one file (file_1) and name of week in another (file_2 ) how can i use "readline" to randomly choose one of file_1 or file_2 then randomly sort name of moth (1. march 2. september 2. july ...) or randomly sort content of file_2 (1- Sunday 2- Saturday... )?
Hi,

Name the files with a sequential name ex. file_1, file_2, file_3, file_4, file_5, etc..
Open the file by adding the prefix of the name "file_" to a Random value between 1 and your max file number.
The function "readline" gives you a list of string, each string is a line of your text file.
Show the list content in any graphic way that you can control with gesture and check them with an array of "position" (that is your solution).
 
Upvote 0
Top