100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Class notes

Object Oriented Programming Health Guide

Rating
5.0
(1)
Sold
1
Pages
2
Uploaded on
12-07-2022
Written in
2018/2019

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

Institution
Course








Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Study Level
Examinator
Subject
Unit

Document information

Uploaded on
July 12, 2022
Number of pages
2
Written in
2018/2019
Type
Class notes
Professor(s)
N/a
Contains
All classes

Subjects

Content preview

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
Free
Get access to the full document:
Download

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached

Get to know the seller
Seller avatar
ItsKenzie
5.0
(9)

Reviews from verified buyers

Showing all reviews
3 year ago

5.0

1 reviews

5
1
4
0
3
0
2
0
1
0
Trustworthy reviews on Stuvia

All reviews are made by real Stuvia users after verified purchases.

Get to know the seller

Seller avatar
ItsKenzie University
Follow You need to be logged in order to follow users or courses
Sold
20
Member since
6 year
Number of followers
10
Documents
78
Last sold
2 year ago
IT and Cyber Security Notes For Computing Students

I prepare and sell top quality notes and essays that are concise and easy to understand to fellow computing students. It can be overwhelming when you get your first few projects or assignments, using my notes and essays can help you to better understand the modules and hopefully help you get the grades you want. Thanks for visiting my profile, feedback is always appreciated.

5.0

9 reviews

5
9
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions