Point n click-ness?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
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.
Post Reply
Message
Author
Underworld King Star
Newbie
Posts: 4
Joined: Mon Sep 07, 2009 6:05 pm
Contact:

Point n click-ness?

#1 Post by Underworld King Star »

Okay, so basically, in the VN I'm working on, I'm trying to implement some Phoenix Wright-esque bits, in which you can pick up items, and then use them later on or have them be plot-points, etc.

Now, first off, is it possible to have an inventory system? I.e. you'd click a button and you'd have a little inventory screen pop up, and you could click on items you had and either show them to someone or just look at them. i.e. something like

Item: Post-it notes.

on_examine: Well it's my stack of post it notes.
on_show: (Othercharacter) Why are you showing me post-it notes? >_>


I'm not going to ask for the comprehensive code guide to doing this (yet) since I've picked up a couple of bits here and there from other posts and will attempt to do it myself, just to be able to know that this kind of thing is possible before I start.




Secondly, how would one go about having a point-n-click adventure element to the game? Or rather, how would one make hotspots on the screen so that you'd click them and either trigger an event? Would you map co-ordinates?



I'm guessing clicking to go to different places is straightforward but this is possible too, right?

sorry for 1000 questions, I tried to search for this but it was all "point" and "click" are too common words you can't search for them" and using the googlesearch trick didn't work too well either.

thanks in advance~

KimiYoriBaka
Miko-Class Veteran
Posts: 636
Joined: Thu May 14, 2009 8:15 pm
Projects: Castle of Arhannia
Contact:

Re: Point n click-ness?

#2 Post by KimiYoriBaka »

yes, all of that is both possible, and has been done. try downloading the renpy games "attorney d" and "game" (the one by that alex guy that didn't bother naming it). both have the unarchived files that you can use as examples.

User avatar
mugenjohncel
Hentai Poofter
Posts: 2121
Joined: Sat Feb 04, 2006 11:13 pm
Organization: Studio Mugenjohncel
Location: Philippines
Contact:

Re: Point n click-ness?

#3 Post by mugenjohncel »

Underworld King Star wrote:How would one make hotspots on the screen so that you'd click them and either trigger an event? Would you map co-ordinates?
Underworld King Star wrote:I'm guessing clicking to go to different places is straightforward but this is possible too, right?
The easiest way to achieve this is by using Renpy Image-Maps...
http://www.renpy.org/wiki/renpy/doc/ref ... y.imagemap

"POOF" (I go now... Time do do some catching up!)

Underworld King Star
Newbie
Posts: 4
Joined: Mon Sep 07, 2009 6:05 pm
Contact:

Re: Point n click-ness?

#4 Post by Underworld King Star »

mugenjohncel wrote:The easiest way to achieve this is by using Renpy Image-Maps...
http://www.renpy.org/wiki/renpy/doc/ref ... y.imagemap

"POOF" (I go now... Time do do some catching up!)
unless I'm an idiot and can't read, one has to use like, x and y co-ordinates, right? How exactly do you go about sorta, knowing where they are?

I just see myself using trial and error to move this image all over the base thing to try and get it into place.

Adorya
Miko-Class Veteran
Posts: 541
Joined: Fri Aug 18, 2006 4:51 pm
Contact:

Re: Point n click-ness?

#5 Post by Adorya »

If we assume your game is 800x600 or whatever rectangular window size, the upper left angle of it is position x=0 and y=0 while the lower right angle of your rectangle window is x=800 and y=600. The center of your windows is supposed to point at coordinate x=400 and y=300 (half the course)

User avatar
Aleema
Lemma-Class Veteran
Posts: 2677
Joined: Fri May 23, 2008 2:11 pm
Organization: happyB
Tumblr: happybackwards
Contact:

Re: Point n click-ness?

#6 Post by Aleema »

Underworld King Star wrote: unless I'm an idiot and can't read, one has to use like, x and y co-ordinates, right? How exactly do you go about sorta, knowing where they are?
I'm going to tell you what I told someone else.
The easiest way to find the coordinates for a hotspot is by using one of the many image-mapper programs out there. A lot of them are free, too. :)

User avatar
mugenjohncel
Hentai Poofter
Posts: 2121
Joined: Sat Feb 04, 2006 11:13 pm
Organization: Studio Mugenjohncel
Location: Philippines
Contact:

Re: Point n click-ness?

#7 Post by mugenjohncel »

OK here's how it works... Let's say your Vn has a screen size of 800px by 600px

See the code below?...

Code: Select all

label start:
    scene phone_a 
    $ result = renpy.imagemap ("phone_a.png", "phone_b.png",
        [
        (51, 54, 214, 390, "phone_a"),
        (321, 54, 478, 390, "phone_b"), 
        (595, 54, 735, 390, "phone_c"),
        (249, 506, 552, 533, "nope"),
        ], focus="imagemap")
        
    if result == "phone_a":
        jump phone_a
        
    elif result == "phone_b":
        jump phone_b
        
    elif result == "phone_c":
        jump phone_c
        
    elif result == "nope":
       jump nope

    return
Let's focus on this particular line...

Code: Select all

(51, 54, 214, 390, "phone_a")
The first set of number "51" means the hotspot is 51 pixels from the left side of the screen.

The next number "54" means the hotspot is 54 pixels from the top side of the screen.

The next number "214" means the hotspot is 214 pixels from the left side of the screen.

The last number "390" means the hotspot is 390 pixels from the top side of the screen.

The area enclosed by these coordinates will be your hotspot (see image below)
Image

I also attached a sample game so you could study it in greater detail...

Hope this helps...

"POOF" (Disappears)

Post Reply

Who is online

Users browsing this forum: No registered users