I want to make a ball move across the screen. If it is clicked it results in "Good job" or if missed or not click "Try again."
show ball:
xalign -.5 yalign .5
linear 1 xalign 1.5 yalign 1
If clicked:
e Good job.
else:
e Try again.
I get ATL statement contains two expressions in a row.
How do I make clickable objects for if statement?
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
-
- Newbie
- Posts: 1
- Joined: Sat Jul 25, 2015 9:32 pm
- Contact:
- Alera
- Miko-Class Veteran
- Posts: 651
- Joined: Sun Mar 21, 2010 3:20 am
- Completed: Tortichki // Zayay // Hero's Spirit
- Deviantart: psyalera
- itch: psyalera
- Location: UK
- Contact:
Re: How do I make clickable objects for if statement?
I believe what you need to do to make this work is have the ball as an imagebutton and display it in a screen. (Please someone correct me if there is an easier way?)
This would look something like this:
I added some comments but let me know if it's not clear and if you wanted more explanations.
This would look something like this:
Code: Select all
init-2:
transform mov_ball:
xpos -10 ypos -10
linear 1.0 xpos 900 ypos 700
### ^^^ We need this code to create our own transform which will make the ball move
screen moving_ball:
imagebutton:
idle "ball.png"
hover "ball.png" #We could have a different image for the ball on hover if we wanted
at mov_ball #This is what makes it move
action Jump("GoodJob") #We use this instead of an 'if' statement. It only reacts if the ball is clicked.
####Somewhere After the START Label####
label MovBall:
show screen moving_ball #We display the screen with the moving ball
$ renpy.pause(delay=1.0, hard=True) #This is what waits for the ball to go across and makes something happen if we missed it.
hide screen moving_ball
"You missed the ball. Try again."
jump MovBall
label GoodJob:
hide screen moving_ball
"Good job!"
Who is online
Users browsing this forum: Bing [Bot], Majestic-12 [Bot]