100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
Object Oriented Programming Health Guide £0.00

Lecture notes

Object Oriented Programming Health Guide

1 review
 8 views  1 purchase

This document contains a guide on how to create a health system for the program, this guide will aid with the assignment.

Preview 1 out of 2  pages

  • July 12, 2022
  • 2
  • 2018/2019
  • Lecture notes
  • N/a
  • All classes
All documents for this subject (10)

1  review

review-writer-avatar

By: MitchK • 2 year ago

avatar-seller
ItsKenzie
Hearts for Lives

1. Open your gameShell project
2. Add a Usercontrol call it Hearts.vb
3. Add three pictureboxes to contain hearts, and one that stretches over the three to hold the
Then add code to the usercontrol which will enable you to add lives, lose a life and
displaylives. Note: that displaylives is private [ie an example of an encapsulate method that
the user doesn’t need to know of its existence]
Public Class ucHearts
'this user control - demonstrates a Large heart image made up from several smaller heart
'and as each life dies so a small heart disappears... until there are none left = Game over
Private _Lives As Integer = 0 'max lives is 3
Public Property lives As Integer
Get
lives = _Lives
End Get
Set(ByVal value As Integer)
If value > 3 Then
_Lives = 3
Else
_Lives = value
End If
displayLives()
End Set
End Property
Public Sub loseLife()
_Lives -= 1
displayLives()
End Sub
Public Sub gainLife()
_Lives += 1
displayLives()
End Sub
Private Sub displayLives()
picGameOver.Visible = False
picGameOver.SendToBack()
Select Case _Lives
Case 0
noHearts()
picGameOver.Visible = True
picGameOver.BringToFront()
Case 1
picHeart1.Visible = True
picHeart2.Visible = False
picHeart3.Visible = False
Case 2
picHeart1.Visible = True
picHeart2.Visible = True
picHeart3.Visible = False
Case 3
picHeart1.Visible = True
picHeart2.Visible = True
picHeart3.Visible = True
Case Else
_Lives = 0
displayLives()
End Select
End Sub

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller ItsKenzie. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for £0.00. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

67474 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy revision notes and other study material for 14 years now

Start selling
Free  1x  sold
  • (1)