Is it Android 5?It's a nice game!
However, there's something wrong when I rotate the picture. It's a blur white image.
Thanks for @susu and @Peter Simpson fixes for rotation and Android 5.0:No, it's Android 4.1.2.
Hmm...I cant seem to reproduce this.I found another bug. Open first picture -> OK. Open another picture -> Can not move parts.
cbc551's entry, Xmas Mahjong, has been added to the first post
For those who want to play xmas mahjong and have small screen, can do zoom pinching the screen with two fingers
Nice app! However, when I won the game, there's an error like this screenshot.
View attachment 30536
#Region Project Attributes
#ApplicationLabel: Santa got stuck up the chimney
#VersionCode: 1
#VersionName: B4a Compo
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: portrait
#CanInstallToExternalStorage: True
#End Region
#Region Activity Attributes
#FullScreen: True
#IncludeTitle: False
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim TimerClock As Timer
TimerClock.Initialize("TimerClock",1000)
Dim MediaPlayer1 As MediaPlayer
Dim MoveTimer As Timer
MoveTimer.Initialize("MoveTimer", 10000) 'Used to move SantaImg around a bit
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Private GD As GestureDetector 'Used to detect swipe up gesture for pulling up santas pants
Private HowToPlayBtn As Button
Private HowToPlayImg As ImageView
Private menuimg As ImageView
Private StartBtn As Button
Private SantaCounter As Int : SantaCounter= 0
Private SantaImg As ImageView
Private ScoreLbl As Label
Private CountUp As Int : CountUp = 0
Private TimeLbl As Label
Private RndNum As Int 'Used for selecting a random number for the required amount of clicks (santa pushes) to complete the game
Private SantaLeftImg As ImageView
Private SantaRightImg As ImageView
Private EndGamePanel As Panel
Private FinalScoreLbl As Label
Private PlayAgainImg As ImageView
Private WinorLoseLbl As Label
Private UploadToFbImg As ImageView
Private SantaDownImg As ImageView
Private SantaFullDownImg As ImageView
Private BgPanel As Panel
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("main")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
MediaPlayer1.Stop
End Sub
Sub HowToPlayBtn_Click
HowToPlayImg.Visible = True
HowToPlayImg.BringToFront
End Sub
Sub HowToPlayImg_Click
HowToPlayImg.Visible = False
End Sub
Sub TimerClock_Tick
CountUp = CountUp +1
TimeLbl.Text = CountUp &" Seconds"
End Sub
Sub Wait(MilliSekunden As Int) 'Code found on the b4x forum to have a wait command.
Dim Ti As Long 'Not ideal as it has caused lag on testing but lowering the wait time to 200 minimised the lag
Ti = DateTime.Now + MilliSekunden
Do While DateTime.Now < Ti
DoEvents
Loop
End Sub
Sub MoveTimer_Tick
SantaImg.Visible = False
SantaLeftImg.Visible = True
Wait(200) 'Waiting any longer on my samsung s2 caused lag and slowed the game down whie this was run for the first time. It works fine after the left,right image.
SantaLeftImg.Visible = False
SantaImg.Visible = True
Wait(200)
SantaImg.Visible = False
SantaRightImg.Visible = True
Wait(200)
SantaRightImg.Visible = False
SantaImg.Visible = True
End Sub
Sub StartBtn_Click
Activity.LoadLayout("game")
GD.SetOnGestureListener(Activity, "Gesture")
RndNum = Rnd(200, 500) 'A random number generated to select the range of clicks required to be able to click. e.g (1,5) within 5 clicks of SantaImg you will win.
TimerClock.Enabled = True
MoveTimer.Enabled = True
MediaPlayer1.Initialize() 'Initialize mediaplayer here so it will always replay the tune on StartBtn_Click.
MediaPlayer1.Load(File.DirAssets, "SantaSong3.ogg")
MediaPlayer1.Play
MediaPlayer1.Looping = True
ScoreLbl.Text = 0 &" Score"
StartBtn.Enabled = False
HowToPlayBtn.Enabled = False
End Sub
Sub SantaImg_Click
'MediaPlayer1.Play
SantaCounter = SantaCounter +1 'Adds a point to the scorelbl for each click/press.
ScoreLbl.Text = SantaCounter &" Score"
If SantaCounter = RndNum -40 Then 'Had to use - instead of / as / wouldnt work, just ignored the code for unknown reasons but same code with - instead works fine :S
SantaImg.Visible = False
SantaDownImg.Visible = True
SantaDownImg.BringToFront
End If
If SantaCounter = RndNum -130 Then
SantaImg.Visible = False
SantaDownImg.Visible = True
End If
If SantaCounter = RndNum -220 Then
SantaImg.Visible = False
SantaDownImg.Visible = True
End If
If RndNum = SantaCounter Then 'If the Random number selected meets the required amount of SantaImg presses.
EndGamePanel.Visible = True ' Brings up the end game panel to play again or upload socre to facebook
WinorLoseLbl.Text = "Congratulations, you helped Santa down the chimney"
FinalScoreLbl.Text = TimeLbl.Text & " with a score of " &ScoreLbl.Text 'Used to display the time taken and the amount of clicks on a bigger label at the end of game
TimerClock.Enabled = False 'To stop the timer from continuing after games has ended.
SantaImg.Enabled = False ' To stop extra presses on SantaImg which will alter score after RndNum requirement is met.
MediaPlayer1.Stop ' Stops music from playing when completed the game.
End If
End Sub
Sub SantaDownImg_Click
SantaDownImg.Visible = False
SantaFullDownImg.Visible = True
ToastMessageShow("Arghh!!!! Santa's pants!!!", True)
End Sub
Sub SantaFullDownImg_Click
EndGamePanel.Visible = True ' Brings up the end game panel to play again or upload socre to facebook
WinorLoseLbl.Text = "Wow, this is not cool, keep that hidden. YOU LOSE"
FinalScoreLbl.Text = TimeLbl.Text & " with a score of " &ScoreLbl.Text 'Used to display the time taken and the amount of clicks on a bigger label at the end of game
TimerClock.Enabled = False 'To stop the timer from continuing after games has ended.
SantaImg.Enabled = False ' To stop extra presses on SantaImg which will alter score after RndNum requirement is met.
MediaPlayer1.Stop ' Stops music from playing when completed the game.
End Sub
Sub SantaRightImg_Click
SantaCounter = SantaCounter +1
ScoreLbl.Text = SantaCounter &" Score"
If RndNum = SantaCounter Then 'If the Random number selected meets the required amount of SantaImg presses.
EndGamePanel.Visible = True ' Brings up the end game panel to play again or upload socre to facebook
WinorLoseLbl.Text = "Congratulations, you helped Santa down the chimney"
FinalScoreLbl.Text = TimeLbl.Text & " with a score of " &ScoreLbl.Text 'Used to display the time taken and the amount of clicks on a bigger label at the end of game
TimerClock.Enabled = False 'To stop the timer from continuing after games has ended.
SantaImg.Enabled = False ' To stop extra presses on SantaImg which will alter score after RndNum requirement is met.
MediaPlayer1.Stop
End If
End Sub
Sub SantaLeft_Click
SantaCounter = SantaCounter +1
ScoreLbl.Text = SantaCounter &" Score"
If RndNum = SantaCounter Then 'If the Random number selected meets the required amount of SantaImg presses.
EndGamePanel.Visible = True ' Brings up the end game panel to play again or upload socre to facebook
WinorLoseLbl.Text = "Congratulations, you helped Santa down the chimney"
FinalScoreLbl.Text = TimeLbl.Text & " with a score of " &ScoreLbl.Text 'Used to display the time taken and the amount of clicks on a bigger label at the end of game
TimerClock.Enabled = False 'To stop the timer from continuing after games has ended.
SantaImg.Enabled = False ' To stop extra presses on SantaImg which will alter score after RndNum requirement is met.
MediaPlayer1.Stop
End If
End Sub
Sub PlayAgainImg_Click
Activity.RemoveAllViews
CountUp = 0
SantaCounter = 0
StartBtn.Enabled = True
HowToPlayBtn.Enabled = True
Activity.LoadLayout("main")
End Sub
Sub UploadToFbImg_Click
Dim TheUrl As String
TheUrl = "https://www.b4x.com/android/forum/threads/b4a-minigame-competition-2014-xmas-edition.47278/"
Dim i As Intent
i.Initialize(i.ACTION_VIEW, "http://m.facebook.com/sharer.php?u= I played Santa got stuck in the chimney and got a time and score of "&SantaCounter &CountUp & TheUrl)
i.SetType("text/plain")
i.PutExtra("android.intent.extra.TEXT", TheUrl)
i.WrapAsIntentChooser("Open browser")
StartActivity(i)
End Sub
Sub Gesture_onFling(velocityX As Float, velocityY As Float, MotionEvent1 As Object, MotionEvent2 As Object)
If Abs(velocityY) > Abs (velocityX) Then 'No idea, seen it on b4x forum and it works. (after hours of searching and trying to understand :D
SantaDownImg.Visible = False
SantaFullDownImg.Visible = False
SantaImg.Visible = True
End If
End Sub
It's not completely finished, I've run out of time
The game element is pretty much done although I did think that an occasional target that isn't supposed to be hit might have been a nice touch. The Menu button does nothing, the intention was to be able to adjust the difficulty by setting the elf image size and initial refresh interval. The score button is what I'm currently working on and is very basic at the moment, it was supposed to show the score, hit ratio and date. I think that after searching the forums maybe I should have used the KeyValueStore class.
I've not got a Google Play account or anything like that as I'm only a hobbyist programmer and so please find attached my project file. Hope you all have a lovely Christmas and all the best for the New year!
kind regards,
RandomCoder
@LucaMs very sorry about that! I purposely haven't upgraded to version 4 yet for that very reason. Anyway, here's the APK file (I believe it's been renamed result.apk presumably because I have used a space in the project name?).that ugly Christmas... I can not even load your sources (B4A 3.0)
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?