Flash question
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.
- PyTom
- Ren'Py Creator
- Posts: 16096
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Flash question
Does anyone know if there's a way, in Flash or Flex, to pause actionscript execution, wait for events, and then continue? Essentially, the equivalent of ui.interact in python?
Thanks.
Thanks.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
- jack_norton
- Lemma-Class Veteran
- Posts: 4087
- Joined: Mon Jul 21, 2008 5:41 pm
- Completed: Too many! See my homepage
- Projects: A lot! See www.winterwolves.com
- Tumblr: winterwolvesgames
- Contact:
Re: Flash question
I don't know much of Flex (I just made some tests) but it should work in normal loops, so a do{}while would work I think.
I presume you're porting renpy to flash then?
I presume you're porting renpy to flash then?
- PyTom
- Ren'Py Creator
- Posts: 16096
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Re: Flash question
I'm considering something like that. The current idea is to write/improve a python->javascript converter, so that I can reuse large chunks of Ren'Py. This won't be for several months at least, though. Since Javascript runs everywhere with smaller interpreters than python, this will be the key of getting a large subset of Ren'Py running on things like Android, iPhone, and Flash.
The goal would be to get something that supports most of the Displayables and ui functions, perhaps with some simplification when it comes to styles and the like.
I'm not sure the do/while clause will work though, since I'm not sure that Flash can update the screen while javascript code is running. I thought it was single threaded... but I'm by no means a flash expert. (And I'll have to become one if this is to have a chance of working.)
Well, this is all many months away, as I have a lot of things I want to do to Ren'Py proper first. And just to clarify, these additional platforms will probably be a commercial deal, with Ren'Py proper (targeting Linux, Mac, PC, and similar platforms) remaining free.
The goal would be to get something that supports most of the Displayables and ui functions, perhaps with some simplification when it comes to styles and the like.
I'm not sure the do/while clause will work though, since I'm not sure that Flash can update the screen while javascript code is running. I thought it was single threaded... but I'm by no means a flash expert. (And I'll have to become one if this is to have a chance of working.)
Well, this is all many months away, as I have a lot of things I want to do to Ren'Py proper first. And just to clarify, these additional platforms will probably be a commercial deal, with Ren'Py proper (targeting Linux, Mac, PC, and similar platforms) remaining free.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
-
- Eileen-Class Veteran
- Posts: 1314
- Joined: Mon Sep 19, 2005 2:15 am
- Completed: Controlled Chaos / Sum of the Parts / "that" Midna game with ZONEsama
- Projects: Sparse Series/Oddments Shop original cartoon in Pevrea; Cybernetic Duels (fighting game); Good Vibin'
- Organization: Watercolorheart Studios
- IRC Nick: BCS
- Tumblr: adminwatercolor
- Deviantart: itsmywatercolorheart
- Github: Watercolordevdev
- Skype: heartnotes
- Soundcloud: Watercollider
- itch: watercolorheart
- Location: Florida
- Contact:
Re: Flash question
People keep on asking me to port stuff to Flash and I keep on telling them that it would be too much work and not worth it ... .
I'm not even the same person anymore
-
- Veteran
- Posts: 208
- Joined: Tue Dec 30, 2008 9:18 am
- Projects: Everlasting Summer; The Herbalist; iiCharacter; iiOS
- Contact:
Re: Flash question
What about pure python code?
It's a much more powerful and flexible thing, then action script. I don't believe it have all the features of python...
By the way, Python port for PSP exists, maybe it exists for other gadgets too...
It's a much more powerful and flexible thing, then action script. I don't believe it have all the features of python...
By the way, Python port for PSP exists, maybe it exists for other gadgets too...
- PyTom
- Ren'Py Creator
- Posts: 16096
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Re: Flash question
Python is great, but it's also fairly heavyweight, and not portable to very many embedded devices.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
-
- Veteran
- Posts: 208
- Joined: Tue Dec 30, 2008 9:18 am
- Projects: Everlasting Summer; The Herbalist; iiCharacter; iiOS
- Contact:
Re: Flash question
Flash version of RenPy (RenFlay?)))) would be a separate project?
Or you plan a full migration from "fairly heavyweight" python to "portable to very many embedded devices" flash?
Or you plan a full migration from "fairly heavyweight" python to "portable to very many embedded devices" flash?
- PyTom
- Ren'Py Creator
- Posts: 16096
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Re: Flash question
It would be a moderately separate project, perhaps sharing some code. Ren'Py will remain 100% open source for all purposes, while Ren'Py Lite will be available commercially, I think.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
Re: Flash question
Now this is truly fantastic news
And also the idea of having a commercial version is fine with me ( as long as it doesn't burst my budget ).
My plans are to make some commercial VN's in german. This will be quite difficult since VN'S aren't very popular here. And having the chance to provide several means of running VN'S - localy and online - would greatly enhance the acceptance.
A nice platform would also be the nintendo DS, but I didn't do any research of how it could be implemented.
IMO it would be important to provide a platform that is able to run VN's on office pc's at work. So having to download the newest Flash version or other plugins wouldn't be to good since most people aren't allowed to do so. Being able to save online instead of locally would be important too.
Oh, and for your question: Maybe this answers it: http://www.actionscript.org/forums/show ... p3?t=33910
This is so great
And also the idea of having a commercial version is fine with me ( as long as it doesn't burst my budget ).
My plans are to make some commercial VN's in german. This will be quite difficult since VN'S aren't very popular here. And having the chance to provide several means of running VN'S - localy and online - would greatly enhance the acceptance.
A nice platform would also be the nintendo DS, but I didn't do any research of how it could be implemented.
IMO it would be important to provide a platform that is able to run VN's on office pc's at work. So having to download the newest Flash version or other plugins wouldn't be to good since most people aren't allowed to do so. Being able to save online instead of locally would be important too.
Oh, and for your question: Maybe this answers it: http://www.actionscript.org/forums/show ... p3?t=33910
This is so great
- EwanG
- Miko-Class Veteran
- Posts: 711
- Joined: Thu Oct 26, 2006 5:37 pm
- Location: San Antonio, TX
- Contact:
Re: Flash question
Assuming you use ActionScript 3 (AS3), then you attache your events to the buttons who's state you are interested in, and flash handles it for you.
For example, if I have a menu, then I have either a Dynamic Text Field or a Button or a Movie Clip that I am using for my menu item. In fact, because of this setup the item can be any shape you want - so you could have wagon wheels as your menu items.
You would then do something like:
The item in front is the item you are working with (Dynamic Text field, etc), and the second item in the addEventListener is the function that will be called when the event occurs. This isn't just for Mouse events. It can also respond to keyboard events or to Timer events.
While Flash is waiting for you to click one of those, it will continue to loop music or any other animation that isn't waiting on an event.
Hope this helps,
Ewan
For example, if I have a menu, then I have either a Dynamic Text Field or a Button or a Movie Clip that I am using for my menu item. In fact, because of this setup the item can be any shape you want - so you could have wagon wheels as your menu items.
You would then do something like:
Code: Select all
P18MenuText.visible = true;
P18MenuText.addEventListener(MouseEvent.CLICK, P18MenuFunc);
P18Men1.text = "Yes, I'm a big fan of Kierkegaard.";
P18Men1.setTextFormat(dText, 0, P18Men1.text.length);
P18Men1.addEventListener(MouseEvent.CLICK, P18Menu1Func);
P18Men2.text = "To be honest, this is just a book I was assigned.";
P18Men2.setTextFormat(dText, 0, P18Men2.text.length);
P18Men2.addEventListener(MouseEvent.CLICK, P18Menu2Func);
While Flash is waiting for you to click one of those, it will continue to loop music or any other animation that isn't waiting on an event.
Hope this helps,
Ewan
Working on something... might even be something good
Re: Flash question
I second what EwanG says.
If you want something that's more state based, I suggest using a variable to point to a function. Then, create an Event.ENTER_FRAME event listener. If the function pointer is set to null, don't call it. Otherwise, call the function as normal. Then, when necessary, point it to a function that listens for keyboard/mouse events. This is how I tend to set up my Flash games and it seems to work well.
Example:
Hope this helps. Let me know if something doesn't make sense.
If you want something that's more state based, I suggest using a variable to point to a function. Then, create an Event.ENTER_FRAME event listener. If the function pointer is set to null, don't call it. Otherwise, call the function as normal. Then, when necessary, point it to a function that listens for keyboard/mouse events. This is how I tend to set up my Flash games and it seems to work well.
Example:
Code: Select all
//Overall idea:
//The application sits and waits for the user to click the mouse on the child movieclip.
//Then, it calls a function every frame cycle to see if the spacebar has been pressed
//If so, then it traces out a message and then stops checking for keyboard presses.
private var myFunc:Function = null; //pointer to our current state.
private var myMovie:MovieClip = new SomeMovieClip(); //Listens for mouse events
//Constructor
public function classConstructor():void
{
this.addEventListener( Event.ENTER_FRAME, update );
myMovie.addEventListener( MouseEvent.CLICK, mouseClick );
this.addChild( myMovie );
}
//Our function that executes on every ENTER_FRAME event
public function update( e:Event ):void
{
if ( myFunc != null ) //Do we have a function to call?
myFunc();
}
//Sets the application to wait for a keyboard event if the user clicks the mouse on the movieclip.
public function mouseClick( e:MouseEvent ):void
{
if ( myFunc != wait ) //Is the function already looking for keyboard input? If not, then let's set it to do so!
{
trace( "Now we wait for a keyboard event!" );
myFunc = wait;
}
}
//listens to see if a key has been pressed since the last frame
public function wait():void
{
//I can't remember how to set up keyboard event listeners off of the top of my head, sorry.
//So this assumes that you have some sort of keyboard event listener already
if ( KeyIsDown( SPACEBAR ) )
{
trace( "Spacebar pressed!" );
myFunc = null; //state is set to null, so no more listening for keyboard events again until the user clicks the mouse again
}
}
Who is online
Users browsing this forum: Amazon [Bot], Ocelot