TailsSena Posted September 1, 2012 Report Share Posted September 1, 2012 So... How do I make two Sub-Applications share information? I'm trying to make a game that looks like a DS game, two screens included. (Don't ask why.) Anyway, the top screen is the one with tons of programming, using my own Isometric engine... The bottom can display a map, a status screen, and a pause screen... Regular DS stuff... But all of them require the top screen's values to be shared with the bottom... Link to comment Share on other sites More sharing options...
LarkSS Posted September 1, 2012 Report Share Posted September 1, 2012 One of the few things the sub-app can share are global values and strings, so you'd have to take the values to want to share, stuff them into globals, and then read those same values on the sub-app side. Keep in mind you'll be setting yourself up for headaches by using the sub-app though... Link to comment Share on other sites More sharing options...
TailsSena Posted September 2, 2012 Author Report Share Posted September 2, 2012 So... Let me get this straight... Sub-App 1 shares the global values to the main app, and then to Sub-App 2, right? Oh, yes. I know it's going to give me headaches, already has, but I think it might be worth it. Link to comment Share on other sites More sharing options...
GSF Posted September 2, 2012 Report Share Posted September 2, 2012 Sub-applications have the "Share" properties for Global Values/Strings, and Score/Lives values. Simply add the values you need to your parent application, and have both-subapps with the share global values property on. The values will carry on to any of the three applications as you modify them. Link to comment Share on other sites More sharing options...
TailsSena Posted September 2, 2012 Author Report Share Posted September 2, 2012 Ohhh... I think I gotcha. The main app lists the values, which both Sub-Apps can modify and read from... Correct? Now, is there a setting for "Master" and "Slave" between the Subs, or will I just have to make sure that the bottom one never modifies anything, only reads? EDIT: Well, it works so far! Thanks! (Seems I didn't check the Sub-Application Properties thoroughly before. Now that sharing is set up, it works fine.) Link to comment Share on other sites More sharing options...
GSF Posted September 2, 2012 Report Share Posted September 2, 2012 There isn't any control of that degree. If you modify the values in the sub-app, the parent app will behave unexpectedly. And yes, that's how it works - if you add new GVs in the parent app, the sub-apps will be able to make use of them as well. Link to comment Share on other sites More sharing options...
TailsSena Posted September 2, 2012 Author Report Share Posted September 2, 2012 Aww... So it's not like a hard-drive... Grr... And the app is going just fine even though the primary Sub app is doing all the modifications. Seems to be working for my purposes. Link to comment Share on other sites More sharing options...
GSF Posted September 2, 2012 Report Share Posted September 2, 2012 Well, it all depends on how these values interact with the application. Seems that in your case no discernible contradictions are prominent. Also, since you're using subapps - don't forget that you can make easy pause menus with them. :] Link to comment Share on other sites More sharing options...
TailsSena Posted September 2, 2012 Author Report Share Posted September 2, 2012 Seems that in your case no discernible contradictions are prominent. Yet. Just wait until Sub2 starts doing things that matter. For clarification, this is a Pokemon game I'm making, so Sub2 will wind up effecting stats and such, which both Subs keep track of. That said, are there any special checks/over-rides I should put into the Parent so that things don't go insane? Link to comment Share on other sites More sharing options...
GSF Posted September 2, 2012 Report Share Posted September 2, 2012 Not really - the default properties sub-apps start with should work for you. You can read more about each of them in the mmf2 manual object library section. Link to comment Share on other sites More sharing options...
TailsSena Posted September 11, 2012 Author Report Share Posted September 11, 2012 Alright... Does anyone know how to check an object is facing another? Link to comment Share on other sites More sharing options...
LarkSS Posted September 11, 2012 Report Share Posted September 11, 2012 Depends on what you're trying to do. Based on your topic title I'm assuming you want to check when a trainer is facing you to initiate a battle? The GBA/DS pokemon games use a tile-based system, where you can only move within a grid. This made it easy to check if one object was facing another as you just trace down a few tiles checking what occupies each tile and stopping iteration if an obstacle such as a rock was encountered. If you are not constrained to a grid in your game however, you'll want to do a rectangle area check. In the example below I'll show how you could handle "seeing" the player when the trainer is specifically looking down (I don't check for obstacles here, and I'm also implying 32x32 tiles and a max range of 5 tiles): Dir("Trainer") = 24 X("Trainer") < X("Player")+16 X("Trainer") > X("Player")-16 Y("Trainer") < Y("Player") Y("Trainer") > Y("Player")-160 -Request Duel with Player Link to comment Share on other sites More sharing options...
TailsSena Posted September 11, 2012 Author Report Share Posted September 11, 2012 Actually, I'm checking to see if you're facing an NPC so you can talk to it. Also, the overworld works like Ranger... No grid, no constraints, everything is real time, all encounter-able things are visible. (This includes wild Pokemon.) ...But that might work. EDIT: Not quite... I need to be able to talk to someone regardless of where I am, as long as I'm within range of them and facing them... EDIT2: Actually, I think I'll devise another way that involves touching them on the bottom screen as they come in range on the top screen. Link to comment Share on other sites More sharing options...
TailsSena Posted October 12, 2012 Author Report Share Posted October 12, 2012 Hmm. Does anybody know how to set an object's position so that the object to be positioned is determines by a calculation? Basically, I need to set the position of an object that the runtime doesn't actually know is going to exist. The reason for this is simple enough. It's how I'm creating the Pokemon... You see, I'm creating them by name based on which one needs to be created, with but one line of code. P_Poke01 is different from 0 - > Create object "Poke "+P_Poke01 Basically, when the value of your first Pokemon isn't zero (aka; nothing), the Pokemon corresponding to that number is created. My problem is that the runtime no longer knows which Pokemon will exist at any point in time, so I can't reposition them unless I can use a Calculation to determine which one to move... Link to comment Share on other sites More sharing options...
Recommended Posts