PDA

View Full Version : Medical Terminology Point-and-Click Adventure Game Issues



IDTstudent
11-13-2019, 03:53 PM
Hi all! I'm developing a medical terminology game for class. It's a point-and-click adventure game where the player has to search the hospital for hidden terms, and once they've found all the terms in a level, they can advance. There are trackers in the top right-hand corner that display 1.) the level #, 2.) the rooms completed [RoomsComp], and 3.) # of terms collected [TermCounter]. The issue is that I have 5 different background images, and therefore 5 different layouts with trackers (Level, RoomsComp, & TermCounter). Because of this, I have to reference all iterations of the tracker throughout.

For example, this is the code that runs when a player clicks on an invisible shape in a room that contains a hidden term:


Sub FOUNDT1()
If T1.Caption = 0 Then
T1.Caption = (T1.Caption) + 1
TermCounter.Caption = (TermCounter.Caption) + 1
SlideLayout56.TermCounter.Caption = (TermCounter.Caption)
SlideLayout55.TermCounter.Caption = (SlideLayout56.TermCounter.Caption)
SlideLayout57.TermCounter.Caption = (SlideLayout56.TermCounter.Caption)
SlideLayout59.TermCounter.Caption = (SlideLayout56.TermCounter.Caption)
If (T2.Caption) + (T3.Caption) + 1 = 3 Then
RoomsComp.Caption = (RoomsComp.Caption) + 1
SlideLayout56.RoomsComp.Caption = (RoomsComp.Caption)
SlideLayout55.RoomsComp.Caption = (SlideLayout56.RoomsComp.Caption)
SlideLayout57.RoomsComp.Caption = (SlideLayout56.RoomsComp.Caption)
SlideLayout59.RoomsComp.Caption = (SlideLayout56.RoomsComp.Caption)
Else
ActivePresentation.SlideShowWindow.View.GotoSlide (30)
End If
Else
ActivePresentation.SlideShowWindow.View.GotoSlide (31)
End If
End Sub

Q1: So the code for the TermCounter works, but I'm wondering--is there a way that "TermCounter" could apply to all iterations of the TermCounter label throughout the game? (My professor mentioned global variables being a potential solution?)
Q2: The RoomsComp does not currently work. In this level, there are 2 rooms, each with 3 terms hidden in them. Do you all see any issues with the code here? If so, how should I rewrite it?

Thanks so much! I'm also happy to upload the game if that would help!

Logit
11-17-2019, 07:39 AM
.
Having the file to review for edits would help very much.

Stanley1
10-14-2021, 12:19 AM
Wow, thanks a lot for this information, i have similar issue, im also developing game for computer class in school! You code might help me!

kennaanna
01-29-2024, 02:45 AM
Q1: To make "TermCounter" apply to all iterations of the TermCounter label throughout the game, you can use global variables. Global variables can be declared outside of any sub or function and can be accessed from anywhere in the code.


Q2: The issue with the RoomsComp code might be that the condition (T2.Caption) + (T3.Caption) + 1 = 3 may not be evaluating as expected. You might need to review the logic and condition for incrementing the RoomsComp. If you share the relevant code or more details, I can provide more specific assistance.