Hello I need help with my lua assignment, it is implemented using Corona SDK (Lu
ID: 3604838 • Letter: H
Question
Hello I need help with my lua assignment, it is implemented using Corona SDK (Lua).
janken_assignment3.pdf
Sign in
Download
CS 371
–
Assignment
3
–
Rock, Paper, Scissor
Figure
1
Game Screen
For this assignment, you will create the Rock,
Paper, Scissor game that featured
Alex
Kidd
© SEGA. You will have to implement the following:
1.
You must use the Composer library and three images
(png,
alex.png,
and
enemy.png
) and create five different scenes using it. I am providing
image sheets/frame dat
a/example code snippets for the sprites. Find and use these
files in the HW3_files folder on our class Canvas.
You
can
check the code for these
sprites and background image frames.
2.
Create five
Composer scenes
(each scene should be maintained with a separate
lua file):
2.1.
The
M
ain
scene
(title screen)
:
Show credits
and two buttons: Start and Time
setting. You have to show:
2.1.1.
Your name (and all member’s names) should be shown
2.1.2.
There is a button; add a ‘Start’ button to move to
L
evel 1.
2.1.3.
There is another button
to move
to
the setting
scene (
2.2
)
.
2.2.
The
Setting
scene:
Allow the player to
set specific time
d
uration
for
selecting
one of the rock, paper and scissor shapes
(See
5
.2
and
5
.3
)
.
2.2.1.
T
he player can set
a
time
/duration (see
5.3
)
between 1
000ms and
10000ms
(default:3000m
s
)
using
a
slider widget
(use the Corona SDK
widget
API
).
Additionally,
the
selected
time value
should be displayed
on the
screen.
2.2.2.
Add a ‘Return’ button to return
to the main menu screen
2.3.
Three levels
(three scenes)
:
2.3.1.
Level 1 (enemy 1 and background 1)
2.3.2.
Level 2 (enemy 2 and background 2)
2.3.3.
Level 3 (boss and background 3)
3.
Ending
message
:
S
how an ending message, and allow you
r player
to go back to the
main
scene by tapping a button or the screen.
4.
Scene Transition: T
he transition between each level should not be abrupt. For
example, after completing Level 1, have a message pop up (perhaps the computer
character will say something), then allow you to tap “go
to next level” before loading
the next level.
If we kept the basic rock, paper, scissor
game, it would become stale very fast. To turn
it into the awesome game that it ought to be, we will make it a bit more challenging by
introducing a timed, sequence
-
based play.
5.
The game rules / mechanics are as follows:
5.1.
As you can see in Figure 1, you
can use this basic layout of Alex (Fig. 1A), the
selection bubble (Fig. 1B), and an opponent (Fig. 1C)
5.2.
Each
round/fight
begins after a countdown of
3 seconds
(
e.g.,
“three
-
> two
-
>
one”
)
to the game start
, and the characters on the game will then begin the
ir
initial “shake” animations (check the code, too)
which will last for 3000ms
(This
time duration
is set with
the slider
at
2.2
)
.
5.3.
During this shake animation, the player can choose one of the rock, paper, and
scissor shapes by tapping the selection bubble
(Fig. 1C).
You wi
ll be able to
select a shape during
between 1
000ms
to 10000ms, according to your setting at
2.2
.
After
this
duration set with
UI (
see
2.2
;
default:
3
000ms
)
,
the last selected
shape becomes your decision and the game also decides your
opponent’s
shape based on a random function.
Also, the game should show your and the
opponent’s
decisions
with outstretched hand sprites simultaneously (see Fig. 1).
You must check the code regarding how to display these sprites.
5.4.
Using
the time bar (Fig. 1D), you need to visualize the
progression of time
while
selecting the shape
(e.g., the leftmost of the bar indicates 0ms and the rightmost
indicates 3000ms)
. You can simply use a default
ProgressViewWidget
for this.
5.5.
Game rule:
The game
has only three possible outcomes other than a tie: a
player who decides to play rock will beat another player who has chosen
scissors ("rock crushes scissors") but will lose to one who has played paper
("paper covers rock"); a play of paper will lose to a
play of scissors ("scissors cut
paper"). If both players choose the same shape, the game is tied and is usually
immediately replayed to break the tie.
5.6.
For each fight, you must show the outcome messages (e.g.,
'Victory!
', "
Draw
" or
“
You Lose
”
)
5.7.
For
each l
evel
(from
L
1 to
L
3)
, there will be 3 rounds. If you
win 2 out of 3
rounds
, you win and get to go to the next level.
6.
You must play wave files in
two different situations:
6.1.
When the user tap the selection bubble: 'select.wav'
6.2.
When the rock scissor
paper
results betwee
n you and enemy have been
shown:
'result.wav'.
7.
If you successfully win on Level 3, it should take you to the Ending Scene.
8.
For these t
hree levels
,
you must use different sprites and backgrounds respectively
(see
2.3
).
9.
A
t the top of the
game screen
(Hide your mobile status bar)
, there should be a
display of the followings (Fig. 1):
The level that the user are currently on
e.g., ‘Level 1’
Number of the wins of Alex and the opponent (for the current level)
e.g., ‘Alex Kidd: 1
Enem
y: 0’
The
time bar
(Fig
.
1D and
5.4
)
This assignment will take some time in getting things tuned correctly:
** You MUST:
Use
composer library
to transition between scenes.
Specifically reference / cite sources for material based on others’
work. In this case, we have
images/sprites from SEGA’s Alex Kidd, which were put together by third parties:
o
http://www.spriters
-
resource.com/master_system/alexkiddmw/she
et/51712/
o
http://www.spriters
-
resource.com/master_system/alexkiddmw/sheet/10911/
o
http://www.spriters
-
resource.com/master_system/alexkiddmw/sheet/51709/
(Links
to
an
external
site.)Links
to
an
external
site.
CS 371 - Assignment 3 - Rock, Paper, Scissor Dr. Chung Due 10/30/2017 You may work with up to two other students (three students for each team) ALEX: 1LEVEL1 ENEMY: 0 B) Figure 1 Game Screen For this assignment, you will create the Rock, Paper, Scissor game that featured Alex Kidd© SEGA. You will have to implement the following: 1. You must use the Composer library and three images (png, alex.png, and enemy.png) and create five different scenes using it. I am providing image sheets/frame data/example code snippets for the sprites. Find and use these files in the HW3 files folder on our class Canvas.You can check the code for these sprites and background image frames. 2. Create five Composer scenes (each scene should be maintained with a separate lua file) 2.1. The Main scene (title screen): Show credits and two buttons: Start and Time setting. You have to show: 2.1.1. Your name (and all member's names) should be shown 2.1.2. There is a button; add a 'Start' button to move to Level 1 2.1.3. There is another button to move to the setting scene (2.2) 2.2. The Setting scene: Allow the player to set specific time duration for selecting one of the rock, paper and scissor shapes (See 5.2 and 5.3) 2.2.1. The player can set a time/duration (see 5.3) between 1000ms and 10000ms (default:3000ms) using a slider widget (use the Corona SDKExplanation / Answer
local NPC_ID = 190002
local price = 5 -- in gold. min 1 gold.
function On_Gossip(event, plr, unit)
if(plr:GetCoinage()>=(price*10000))then
plr:GossipMenuAddItem(0, "Costs "..price.." Gold.", 0, 0, 0)
plr:GossipMenuAddItem(0, "I choose Rock.", 0, 1, 0)
plr:GossipMenuAddItem(0, "I choose Paper.", 0, 2, 0)
plr:GossipMenuAddItem(0, "I choose Scissors.", 0, 3, 0)
plr:GossipMenuAddItem(0, "Nevermind, I would not like to take the risk!", 0, 4,0)
plr:GossipSendMenu(1, unit)
else
plr:SendBroadcastMessage("I require "..price.." gold!")
end
end
function On_Select(event, plr, unit, arg2, intid)
if(intid == 0)then
On_Gossip(event, plr, unit)
return
elseif(intid == 4)then
plr:GossipComplete()
return
else
plr:ModifyMoney(-(price*10000))
plr:SendBroadcastMessage("-"..price.."")
if (intid == 1) then
local m = math.random(1, 3)
if (m == 1) then
plr:SendBroadcastMessage("We both chose rock, we tied!")
plr:GossipComplete()
end
if (m == 2) then
plr:SendBroadcastMessage("I chose paper, I win!")
plr:GossipComplete()
end
if (m == 3) then
plr:SendBroadcastMessage("I chose scissors, QQ.")
plr:SendBroadcastMessage("+"..(price*2).."")
plr:ModifyMoney((price*10000)*2)
plr:GossipComplete()
end
end
if (intid == 2) then
local m = math.random(1, 3)
if (m == 1) then
plr:SendBroadcastMessage("I chose rock, you win.")
plr:SendBroadcastMessage("+"..(price*2).."")
plr:ModifyMoney((price*10000)*2)
plr:GossipComplete()
end
if (m == 2) then
plr:SendBroadcastMessage("We both chose paper, tie!")
plr:GossipComplete()
end
if (m == 3) then
plr:SendBroadcastMessage("I chose scissors and cut through your paper like butter.")
plr:GossipComplete()
end
end
if (intid == 3) then
local m = math.random(1, 3)
if (m == 1) then
plr:SendBroadcastMessage("I chose rock and crushed your puny scissors, I win!")
plr:GossipComplete()
end
if (m == 2) then
plr:SendBroadcastMessage("Aww... Your scissors cut through my paper.")
plr:SendBroadcastMessage("+"..(price*2).."")
plr:ModifyMoney((price*10000)*2)
plr:GossipComplete()
end
if (m == 3) then
plr:SendBroadcastMessage("Parry, we tied!!")
plr:GossipComplete()
end
end
end
end
RegisterCreatureGossipEvent(NPC_ID, 1, On_Gossip)
RegisterCreatureGossipEvent(NPC_ID, 2, On_Select)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.