Daily Archives

Articles indexed Tuesday June 26 2012

Page 13/18 | < Previous Page | 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • creating a contact listener with sprites from different classes

    - by wilM
    I've been trying to set a contact listener that creates a joint on contact between two sprites which have their own individual classes. Both sprites are inheriting from NSObject and their are initialized in their parentlayer (init method of HelloWorldLayer.mm). It is quite straightforward when everything is in the same class, but in a case like this where sprites have their own classes how will it be done. Please Help, I've been at it for days.

    Read the article

  • Dynamic quadrees

    - by paul424
    recently I come out writing Quadtree for creatures culling in Opendungeons game. Thing is those are moving points and bounding hierarchy will quickly get lost if the quadtree is not rebuild very often. I have several variants, first is to upgrade the leaf position , every time creature move is requested. ( note if I would need collision detection anyway, so this might be necessery anyway). Second would be making leafs enough large , that the creature would sure stay inside it's bounding box ( due to its speed limit). The partition of a plane in quadtree is always fixed ( modulo the hierarchical unions of some parts) . For creatures close to the center of the plane , there would be no way of keeping it but inside one big leaf, besides this brokes the invariant that each point can be put into any small area as desired. So on the second thought could I use several quadrees ? Each would have its "coordinate axis XY" somwhere shifted ? Before I start playing with this maybe some other space diving structure would suit me better, unfortunetly wiki does not compare it's execution time : http://en.wikipedia.org/wiki/Grid_%28spatial_index%29#See_also

    Read the article

  • Physics from other games

    - by Carlosrdz1
    I'm making a platform engine with XNA Game Studio, and I've solved almost everything about colliding stuff. But now, I'm searching for good physics for the player, I'm trying to emulate characters from other games like Mario from Super Mario World, or MegaMan X... do you know a website or something, where the physics from that games are revealed? I remember seen a page with something like that. Or what's the process you think is the best to emulate physics from other games? Just trial and error? Thank you.

    Read the article

  • Adjust sprite bounds of the visible part of texture

    - by Crazy D0G
    Is there any way to adjust the boundaries of the visible part of the sprite? To make it easier to understand: I have a texture, such as shown at figure 1. Then I break it into pieces and fill the resulting fragments using PRKit (wood texture on figure 2 and 3). But the resulting fragments have the transparent (green color on figure 2 and 3) and when creating a sprite from the fragments they have the size of the initial texture. Is there a way to get rid of this transparency and to adjust the size of the visible part (wood texture), openGL or cocos2d-x means? Maybe it help - draw() method from PRKit: void PRFilledPolygon::draw() { //CCNode::draw(); glDisableClientState(GL_COLOR_ARRAY); // we have a pointer to vertex points so enable client state glBindTexture(GL_TEXTURE_2D, texture->getName()); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_ONE_MINUS_SRC_ALPHA); glVertexPointer(2, GL_FLOAT, 0, areaTrianglePoints); glTexCoordPointer(2, GL_FLOAT, 0, textureCoordinates); glDrawArrays(GL_TRIANGLES, 0, areaTrianglePointCount); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); //Restore texture matrix and switch back to modelview matrix glEnableClientState(GL_COLOR_ARRAY);}

    Read the article

  • Previewing a Demo Level in Mobile for UDK?

    - by Reno Yeo
    I've already clicked on "Emulate Mobile Features" and everything has been compiled. I've also set the mobile previewer settings to iPhone 4's dimensions and features. However, when i click on the mobile previewer, a new window pops up but it goes into a "Not Responding" mode after a while. Is there anything I'm doing wrong? To be honest, I'm afraid of the difficulty curve required in learning UDK, but I am interested in developing a game for it.

    Read the article

  • How to utilize miniMax algorithm in Checkers game

    - by engineer
    I am sorry...as there are too many articles about it.But I can't simple get this. I am confused in the implementation of AI. I have generated all possible moves of computer's type pieces. Now I can't decide the flow. Whether I need to start a loop for the possible moves of each piece and assign score to it.... or something else is to be done. Kindly tell me the proper flow/algorithm for this. Thanks

    Read the article

  • How does having the Debugger change the game execution on an XBOX 360?

    - by Sebastian Gray
    So I thought my issue was relating to the difference between a Debug and a Release build as per this question: What's the difference between a "Release" Xbox 360 build and a "Debug" one? but I've since found that if I go ahead and build a Creators Club version of the game using a Debug build and deploy to the XBOX, I get the same experience I had with the Release version of my game. However if I run the game from Visual Studio using F5 and having set the XBOX as the default platform, then the game runs as expected. If I change from Debug to Release and run with CTRL+F5 then the game also works as expected. How would running the game with the debugger attached change the results I am getting in game? Is there any way that I can use the same approach or change the default compilation of the game so that I can use this approach to release my game?

    Read the article

  • Box2D physics editor for complex bodies

    - by Paul Manta
    Is there any editor out there that would allow me to define complex entities, with joins connecting their multiple bodies, instead of regular single body entities? For example, an editor that would allow me to 'define' a car as having a main body with two circles as wheels, connected through joints. Clarification: I realize I haven't been clear enough about what I need. I'd like to make my engine data-driven, so all entities (and therefore their Box2D bodies) should be defined externally, not in code. I'm looking for a program like Code 'N' Web's PhysicsEditor, except that one only handles single body entities, no joints or anything like that. Like PhysicsEditor, the program should be configurable so that I can save the data in whatever format I want to. Does anyone know of any such software?

    Read the article

  • scope of variables java

    - by qxc
    Is a variable inside the main, a public variable? public static void main(String[] args) { ......... for(int i=0;i<threads.length;i++) try { threads[i].join(); } catch (InterruptedException e) { e.printStackTrace(); } long time=0; .... } i and time are they both public variables? Of course if my reasoning is correct, also any variable belonging to a public method should be considered public.. am i right? Thanks

    Read the article

  • Hiding dropdown list when list is empty

    - by Amina
    I currently have a dropdown list that is populated on page load and sometimes the dropdown list doesn't contain anything and is empty. I would like the hide the dropdown list whenever there aren't any items in the list. I thought i could do this via javascript but i am not sure what i could be doing wrong because after adding the javascript it stills appear on the page. dropdown select: <select data-bind="options: endReason() ? endReason().SubReasons : [], value: subReasonId, optionsText: 'Text', optionsValue: 'Value', visible: isChecked" name="subReasons"> </select> This is my Javascript: <script type="text/javascript"> function OnClientDropDownOpening(sender, eventArgs) { var combo = $find("<%= subReasons %>"); items = combo.get_items(); if(items.get_count()==0) { eventArgs.set_cancel(true); } } </script>

    Read the article

  • Changing Pushpin Text Color

    - by Yawus
    I'm attempting to display data through the text of a Pushpin object. However, the text color defaults to white which is nigh-invisible when the backdrop is a road-style MapView. Looking through the API, paying especially close attention to PushpinOptions, I couldn't find anything that manipulated text color. Considering that this seems to a fairly basic feature, I'm a little confused as to why it doesn't exist or at least is really hard to find. Am I missing something or does Bing Maps for Android really not let you change the default text color for a Pushpin object?

    Read the article

  • Double hop SQL delegation not working

    - by eKoz
    I've been trying to diagnose this for some time, and unfortunately Im still getting the dreaded anonymous logon issue when trying to connect to a sql db as a domain user. Steps taken: App Pool created with delegation service acct Site / Virtual dir running with Integrated Windows auth only Made sure site itself can use kerberos KB 215383 Service acct added to IIS_WPG group Service acct added to "act as part of operating system" under Local Security settings Service acct added to Log on as service under Local Security Settings HTTP SPN set for web address + service account (and FQDN) MSSQLSvc SPN set for sql box and domain acct sql is running as Trust for delegation turned on service acct, specified services, and sql service acct After all this, Im still getting the exact same error from when I started. Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'. This has advanced my balding by at least 5 years so far. I would greatly appreciate any additional tips on diagnosing or setting up.

    Read the article

  • working with files on "start without debugging"

    - by user1472066
    I'm programming in C, and I have the following problem: I use fopen and try to read from a csv file, that is currently storred in the folder of the exe file of the program. the program works fine in debug mode and release mode, but when I try to run the program in "start without debugging" on visual studio 2008 express edition, the program stops working and windows is showing a message: "*.exe has stopped working. a program caused the program to stop working correctly. windows will close the program and notify you if a solution is available". I've tried running the program on several computers, and it's the same. another information I can give you is that if I enter the full path of the file (C:....file.csv) - then is works just fine, without any problem. I know I didn't write any code, but I hope someone will have an idea why this can happend. thanks is advance.

    Read the article

  • Create "duplicate copy" of github repository

    - by user1483934
    I see answers to similar questions and I'm sure I may just not be familiar enough with Git and Github terminology to know if they apply to my question. What I need to do is to clone an existing Github remote repository (a private repo under another person's username that I have contributor access to) and create a new private remote repo under my account. The existing repo user is going to make significant alterations to the repo, delete, and re-push, before they do that they want me to clone and create a duplicate so we can continue working from the repo under my user. I want to preserve the commit history with the repo if possible. I've cloned locally but don't can't seem to figure out how to push it to a new remote that isn't origined to the original user.

    Read the article

  • Python equivalent of Java's compareTo()

    - by astay13
    I'm doing a project in Python (3.2) for which I need to compare user defined objects. I'm used to OOP in Java, where one would define a compareTo() method in the class that specifies the natural ordering of that class, as in the example below: public class Foo { int a, b; public Foo(int aa, int bb) { a = aa; b = bb; } public int compareTo(Foo that) { // return a negative number if this < that // return 0 if this == that // return a positive number if this > that if (this.a == that.a) return this.b - that.b; else return this.a - that.a; } } I'm fairly new to classes/objects in Python, so I'd like to know what is the "pythonic" way to define the natural ordering of a class?

    Read the article

  • How do I unbind another jQuery function on .click()?

    - by Mike Barwick
    I have this script that run to fix my menu bar to the browser on scroll. Nothing really needs to change here (works as it should). However, you may need it... var div = $('#wizMenuWrap'); var editor = $('#main_wrapper'); var start = $(div).offset().top; $(function fixedPackage(){ $.event.add(window, "scroll", function() { var p = $(window).scrollTop(); $(div).css('position',((p)>start) ? 'fixed' : 'static'); $(div).css('top',((p)>start) ? '0px' : ''); //Adds TOP margin to #main_wrapper (required) $(editor).css('position',((p)>start) ? 'relative' : 'static'); $(editor).css('top',((p)>start) ? '88px' : ''); }); }); Now for the issue at hand. I have another script function that calls a modal pop-up (which again works as it should). However, it's not slick from a UI perspective when I scroll the page when the modals open. So I want to disable the script above when the modal script below is called. In other words, when I click to open the modal pop-up, the script above shouldn't work. $(function () { var setUp = $('.setupButton'); // SHOWS SPECIFIED VIEW $(setUp).click(function () { $('#setupPanel').modal('show'); //PREVENTS PACKAGE SELECT FIXED POSITION ON SCROLL $(setUp).unbind('click',fixedPackage); }); }) As you can see above, I tried to unbind the scroll function (the first code snippet), but this is not correct. These two scripts are in two separate js libraries.

    Read the article

  • What to do if exec() fails?

    - by Grigory
    Let's suppose we have a code doing something like this: int pipes[2]; pipe(pipes); pid_t p = fork(); if(0 == p) { dup2(pipes[1], STDOUT_FILENO); execv("/path/to/my/program", NULL); ... } else { //... parent process stuff } As you can see, it's creating a pipe, forking and using the pipe to read the child's output (I can't use popen here, because I also need the PID of the child process for other purposes). Question is, what should happen if in the above code, execv fails? Should I call exit() or abort()? As far as I know, those functions close the open file descriptors. Since fork-ed process inherits the parent's file descriptors, does it mean that the file descriptors used by the parent process will become unusable?

    Read the article

  • How can I return JSON from node.js backend to frontend without reloading or re-rendering the page?

    - by poleapple
    I am working with node.js. I want to press a search button, make some rest api calls to another server in the backend and return the json back to the front end, and reload a div in the front end so that I won't have to refresh the page. Now I know I can reload just a div with jQuery or just Javascript dom manipulation. But how do I make it call a method on the server side? I could have a submit button and it will make a post request and I can catch it and make my api calls from there, however from the node.js side, when I return, I will have to render the page again. How do I go about returning JSON from the back end to the front end without re-rendering or refreshing my page? Thanks.

    Read the article

  • Dos SET command advanced /A features resource

    - by user66001
    Have done quite a bit of searching for a guide (of any substance) for the above to no avail. Can anyone refer me to one? In the present tense however, I am trying to understand the below code example, which returns a two digit representation of the month, that corresponds to the 3 character month name set in v: SET v=May SET map=Jan-01;Feb-02;Mar-03;Apr-04;May-05;Jun-06;Jul-07;Aug-08;Sep-09;Oct-10;Nov-11;Dec-12 CALL SET v=%%map:*%v%-=%% SET v=%v:;=&rem.% ECHO.%v%

    Read the article

  • JBoss 4.2.3 - how to find path to jar file

    - by Gribbler
    I'm getting an error in a JBOSS application: Static Method [addHeader] not found on JavaBean [class com.ppnet.webservice.WebserviceHeaderWriter] I have checked the WebserviceHeaderWriter.jar that gets deployed into JBOSS and checked it in eclipse. It looks as if it should have this method on it. I think that the JBoss application might be loading a different version of the WebserviceHeaderWriter.jar without this method on it, is there a way to check the location of the file that is getting loaded?

    Read the article

  • One intent is working, second is giving me a crash

    - by user1480742
    ok, so both intents receiver sides are on the same activite and they are sending from different ones....second one is not working, first one does, dont know why...all 3 activites are ok in manifest and all that //second intent on senders side public void onItemSelected(AdapterView<?> arg0, View users, int i, long l) { FILENAME = (adapter.getItem(i)).toString(); Bundle viewBag2 = new Bundle(); viewBag2.putString("profile_name", FILENAME); Intent b = new Intent(OptionsMenu.this, CoreActivity.class); b.putExtras(viewBag2); startActivity(b); } //second intent on receiver side private void Data_transfer() { Bundle gotbasket2 = getIntent().getExtras(); profileName = gotbasket2.getString("profile_name"); } //first (working intent) on senders side public void onClick(View v) { Bundle viewBag = new Bundle(); viewBag.putString("spinner_result", s); a.putExtras(viewBag); } //first (working intent) on receiver side private void Data_transfer() { // TODO Auto-generated method stub Bundle gotbasket = getIntent().getExtras(); x = gotbasket.getString("spinner_result"); } 06-26 20:22:09.787: D/AndroidRuntime(1802): Shutting down VM 06-26 20:22:09.787: W/dalvikvm(1802): threadid=1: thread exiting with uncaught exception (group=0x40015560) 06-26 20:22:09.847: E/AndroidRuntime(1802): FATAL EXCEPTION: main 06-26 20:22:09.847: E/AndroidRuntime(1802): java.lang.RuntimeException: Unable to start activity ComponentInfo{mioc.diver/mioc.diver.CoreActivity}: java.lang.NullPointerException 06-26 20:22:09.847: E/AndroidRuntime(1802): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647) 06-26 20:22:09.847: E/AndroidRuntime(1802): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663) 06-26 20:22:09.847: E/AndroidRuntime(1802): at android.app.ActivityThread.access$1500(ActivityThread.java:117) 06-26 20:22:09.847: E/AndroidRuntime(1802): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931) 06-26 20:22:09.847: E/AndroidRuntime(1802): at android.os.Handler.dispatchMessage(Handler.java:99) 06-26 20:22:09.847: E/AndroidRuntime(1802): at android.os.Looper.loop(Looper.java:123) 06-26 20:22:09.847: E/AndroidRuntime(1802): at android.app.ActivityThread.main(ActivityThread.java:3683) 06-26 20:22:09.847: E/AndroidRuntime(1802): at java.lang.reflect.Method.invokeNative(Native Method) 06-26 20:22:09.847: E/AndroidRuntime(1802): at java.lang.reflect.Method.invoke(Method.java:507) 06-26 20:22:09.847: E/AndroidRuntime(1802): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 06-26 20:22:09.847: E/AndroidRuntime(1802): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 06-26 20:22:09.847: E/AndroidRuntime(1802): at dalvik.system.NativeStart.main(Native Method) 06-26 20:22:09.847: E/AndroidRuntime(1802): Caused by: java.lang.NullPointerException 06-26 20:22:09.847: E/AndroidRuntime(1802): at mioc.diver.CoreActivity.Data_transfer(CoreActivity.java:189) 06-26 20:22:09.847: E/AndroidRuntime(1802): at mioc.diver.CoreActivity.onCreate(CoreActivity.java:88) 06-26 20:22:09.847: E/AndroidRuntime(1802): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 06-26 20:22:09.847: E/AndroidRuntime(1802): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611) 06-26 20:22:09.847: E/AndroidRuntime(1802): ... 11 more

    Read the article

  • How is a set partitioned into valid and invalid items using LINQ?

    - by Aaron Anodide
    Is there a way to write a single LINQ expression to get the same result of the following code? var validations = new Func<conversion, bool>[] { c => c.affiliate.affiliate_id > 0, c => c.campaign_id > 0 }; var invalidConversions = from c in extractedConversions where validations.Any(valid => !valid(c)) select c; var validConversions = from c in extractedConversions where validations.All(valid => valid(c)) select c;

    Read the article

  • how to stop objcopy from padding sections

    - by Jah
    I'm using objcopy on bash (ubuntu linux) and im trying to copy 2 sections from an ELF file using the folowing commend: objcopy -j .section1 -j .section2 The problem is the objcopy is adding some padding between the sections. Is there a way (a flag?) that can stop objcopy from padding the sections? the sections are placed one after the other in the file so there is no need for any kind of padding....

    Read the article

  • Performing calculations by subsets of data in R

    - by Vivi
    I want to perform calculations for each company number in the column PERMNO of my data frame, the summary of which can be seen here: > summary(companydataRETS) PERMNO RET Min. :10000 Min. :-0.971698 1st Qu.:32716 1st Qu.:-0.011905 Median :61735 Median : 0.000000 Mean :56788 Mean : 0.000799 3rd Qu.:80280 3rd Qu.: 0.010989 Max. :93436 Max. :19.000000 My solution so far was to create a variable with all possible company numbers compns <- companydataRETS[!duplicated(companydataRETS[,"PERMNO"]),"PERMNO"] And then use a foreach loop using parallel computing which calls my function get.rho() which in turn perform the desired calculations rhos <- foreach (i=1:length(compns), .combine=rbind) %dopar% get.rho(subset(companydataRETS[,"RET"],companydataRETS$PERMNO == compns[i])) I tested it for a subset of my data and it all works. The problem is that I have 72 million observations, and even after leaving the computer working overnight, it still didn't finish. I am new in R, so I imagine my code structure can be improved upon and there is a better (quicker, less computationally intensive) way to perform this same task (perhaps using apply or with, both of which I don't understand). Any suggestions?

    Read the article

  • Optimising movement on hex grid

    - by Mloren
    I am making a turn based hex-grid game. The player selects units and moves them across the hex grid. Each tile in the grid is of a particular terrain type (eg desert, hills, mountains, etc) and each unit type has different abilities when it comes to moving over the terrain (e.g. some can move over mountains easily, some with difficulty and some not at all). Each unit has a movement value and each tile takes a certain amount of movement based on its terrain type and the unit type. E.g it costs a tank 1 to move over desert, 4 over swamp and cant move at all over mountains. Where as a flying unit moves over everything at a cost of 1. The issue I have is that when a unit is selected, I want to highlight an area around it showing where it can move, this means working out all the possible paths through the surrounding hexes, how much movement each path will take and lighting up the tiles based on that information. I got this working with a recursive function and found it took too long to calculate, I moved the function into a thread so that it didn't block the game but still it takes around 2 seconds for the thread to calculate the moveable area for a unit with a move of 8. Its over a million recursions which obviously is problematic. I'm wondering if anyone has an clever ideas on how I can optimize this problem. Here's the recursive function I'm currently using (its C# btw): private void CalcMoveGridRecursive(int nCenterIndex, int nMoveRemaining) { //List of the 6 tiles adjacent to the center tile int[] anAdjacentTiles = m_ThreadData.m_aHexData[nCenterIndex].m_anAdjacentTiles; foreach(int tileIndex in anAdjacentTiles) { //make sure this adjacent tile exists if(tileIndex == -1) continue; //How much would it cost the unit to move onto this adjacent tile int nMoveCost = m_ThreadData.m_anTerrainMoveCost[(int)m_ThreadData.m_aHexData[tileIndex].m_eTileType]; if(nMoveCost != -1 && nMoveCost <= nMoveRemaining) { //Make sure the adjacent tile isnt already in our list. if(!m_ThreadData.m_lPassableTiles.Contains(tileIndex)) m_ThreadData.m_lPassableTiles.Add(tileIndex); //Now check the 6 tiles surrounding the adjacent tile we just checked (it becomes the new center). CalcMoveGridRecursive(tileIndex, nMoveRemaining - nMoveCost); } } } At the end of the recursion, m_lPassableTiles contains a list of the indexes of all the tiles that the unit can possibly reach and they are made to glow. This all works, it just takes too long. Does anyone know a better approach to this?

    Read the article

< Previous Page | 9 10 11 12 13 14 15 16 17 18  | Next Page >