Search Results

Search found 4929 results on 198 pages for 'character'.

Page 8/198 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Updating sprite location with controls

    - by iQue
    So ive got a character in a 2D game using surfaceView that I want to be able to move using a button(eventually a joystick), but my game crashes as soon as I try to move my sprite. This is my onTouch-method for my steering button: public void handleActionDown(int eventX, int eventY) { if (eventX >= (x - bitmap.getWidth() / 2) && (eventX <= (x + bitmap.getWidth()/2))) { if (eventY >= (y - bitmap.getHeight() / 2) && (y <= (y + bitmap.getHeight() / 2))) { setTouched(true); } else { setTouched(false); } } else { setTouched(false); } and if I try to put this in my update-method: public void update() { x += (speed.getXv() * speed.getxDirection()); y += (speed.getYv() * speed.getyDirection()); } the sprite moves on its own just fine, but as soon as I add: public void update() { if(steering.isTouched()){ x += (speed.getXv() * speed.getxDirection()); y += (speed.getYv() * speed.getyDirection()); } the game crashes. Does any1 know why this is or how to fix it? I cannot figure it out. Im using MotionEvent.ACTION_DOWN to check if the user if pressing the screen. }

    Read the article

  • Crash when trying to detect touch

    - by iQue
    I've got a character in a 2D game using surfaceView that I want to be able to move using a button (eventually a joystick), but my game crashes as soon as I try to move my sprite. This is my onTouch-method for my steering button: public void handleActionDown(int eventX, int eventY) { if (eventX >= (x - bitmap.getWidth() / 2) && (eventX <= (x + bitmap.getWidth()/2))) { if (eventY >= (y - bitmap.getHeight() / 2) && (y <= (y + bitmap.getHeight() / 2))) { setTouched(true); } else { setTouched(false); } } else { setTouched(false); } And if I try to put this in my update-method: public void update() { x += (speed.getXv() * speed.getxDirection()); y += (speed.getYv() * speed.getyDirection()); } The sprite moves on its own just fine, but as soon as I add: public void update() { if(steering.isTouched()){ x += (speed.getXv() * speed.getxDirection()); y += (speed.getYv() * speed.getyDirection()); } the game crashes. Does anyone know why this is or how to fix it? I cannot figure it out. I'm using MotionEvent.ACTION_DOWN to check if the user if pressing the screen.

    Read the article

  • Implementing a wheeled character controller

    - by Lazlo
    I'm trying to implement Boxycraft's character controller in XNA (with Farseer), as Bryan Dysmas did (minus the jumping part, yet). My current implementation seems to sometimes glitch in between two parallel planes, and fails to climb 45 degree slopes. (YouTube videos in links, plane glitch is subtle). How can I fix it? From the textual description, I seem to be doing it right. Here is my implementation (it seems like a huge wall of text, but it's easy to read. I wish I could simplify and isolate the problem more, but I can't): public Body TorsoBody { get; private set; } public PolygonShape TorsoShape { get; private set; } public Body LegsBody { get; private set; } public Shape LegsShape { get; private set; } public RevoluteJoint Hips { get; private set; } public FixedAngleJoint FixedAngleJoint { get; private set; } public AngleJoint AngleJoint { get; private set; } ... this.TorsoBody = BodyFactory.CreateRectangle(this.World, 1, 1.5f, 1); this.TorsoShape = new PolygonShape(1); this.TorsoShape.SetAsBox(0.5f, 0.75f); this.TorsoBody.CreateFixture(this.TorsoShape); this.TorsoBody.IsStatic = false; this.LegsBody = BodyFactory.CreateCircle(this.World, 0.5f, 1); this.LegsShape = new CircleShape(0.5f, 1); this.LegsBody.CreateFixture(this.LegsShape); this.LegsBody.Position -= 0.75f * Vector2.UnitY; this.LegsBody.IsStatic = false; this.Hips = JointFactory.CreateRevoluteJoint(this.TorsoBody, this.LegsBody, Vector2.Zero); this.Hips.MotorEnabled = true; this.AngleJoint = new AngleJoint(this.TorsoBody, this.LegsBody); this.FixedAngleJoint = new FixedAngleJoint(this.TorsoBody); this.Hips.MaxMotorTorque = float.PositiveInfinity; this.World.AddJoint(this.Hips); this.World.AddJoint(this.AngleJoint); this.World.AddJoint(this.FixedAngleJoint); ... public void Move(float m) // -1, 0, +1 { this.Hips.MotorSpeed = 0.5f * m; }

    Read the article

  • What's the UITableView index magnifying glass character?

    - by David Grant
    In Apple's iPhone apps (like Contacts), they have a nice magnifying glass icon at the top of the table view index. Since the table view index API is character-based, I assume that this magnifying glass is a Unicode character. So far I've resorted to placing a question mark character there, but that looks lame. Can anyone tell me what character the magnifying glass is?

    Read the article

  • What is the Null Character literal in TSQL?

    - by David in Dakota
    I am wondering what the literal for a Null character (e.g. '\0') is in TSQL. Note: not a NULL field value, but the null character (see link). I have a column with a mix of typical and a null character. I'm trying to replace the null character with a different value. I would have thought that the following would work but it is unsuccessfull: select REPLACE(field_with_nullchar, char(0), ',') from FOO where BAR = 20

    Read the article

  • postgresql deleteing old tables

    - by BB
    I have a postgresql database which stores my radius connection information. What I want to do is only store a months worth of logs. How would I craft a sql statement that I can run from cron that would go and delete and rows that where older then a month? Format of the date in the table. that date is taken from acctstoptime collum Date format 2010-01-27 16:02:17-05 Format of the table in question. -- Table: radacct -- DROP TABLE radacct; CREATE TABLE radacct ( radacctid bigserial NOT NULL, acctsessionid character varying(32) NOT NULL, acctuniqueid character varying(32) NOT NULL, username character varying(253), groupname character varying(253), realm character varying(64), nasipaddress inet NOT NULL, nasportid character varying(15), nasporttype character varying(32), acctstarttime timestamp with time zone, acctstoptime timestamp with time zone, acctsessiontime bigint, acctauthentic character varying(32), connectinfo_start character varying(50), connectinfo_stop character varying(50), acctinputoctets bigint, acctoutputoctets bigint, calledstationid character varying(50), callingstationid character varying(50), acctterminatecause character varying(32), servicetype character varying(32), xascendsessionsvrkey character varying(10), framedprotocol character varying(32), framedipaddress inet, acctstartdelay integer, acctstopdelay integer, freesidestatus character varying(32), CONSTRAINT radacct_pkey PRIMARY KEY (radacctid) ) WITH (OIDS=FALSE); ALTER TABLE radacct OWNER TO radius; -- Index: freesidestatus -- DROP INDEX freesidestatus; CREATE INDEX freesidestatus ON radacct USING btree (freesidestatus); -- Index: radacct_active_user_idx -- DROP INDEX radacct_active_user_idx; CREATE INDEX radacct_active_user_idx ON radacct USING btree (username, nasipaddress, acctsessionid) WHERE acctstoptime IS NULL; -- Index: radacct_start_user_idx -- DROP INDEX radacct_start_user_idx; CREATE INDEX radacct_start_user_idx ON radacct USING btree (acctstarttime, username);

    Read the article

  • postgresql deleteing old records from log tables

    - by Max
    I have a postgresql database which stores my radius connection information. What I want to do is only store a months worth of logs. How would I craft a sql statement that I can run from cron that would go and delete and rows that where older then a month? Format of the date in the table. that date is taken from acctstoptime collum Date format 2010-01-27 16:02:17-05 Format of the table in question. -- Table: radacct CREATE TABLE radacct ( radacctid bigserial NOT NULL, acctsessionid character varying(32) NOT NULL, acctuniqueid character varying(32) NOT NULL, username character varying(253), groupname character varying(253), realm character varying(64), nasipaddress inet NOT NULL, nasportid character varying(15), nasporttype character varying(32), acctstarttime timestamp with time zone, acctstoptime timestamp with time zone, acctsessiontime bigint, acctauthentic character varying(32), connectinfo_start character varying(50), connectinfo_stop character varying(50), acctinputoctets bigint, acctoutputoctets bigint, calledstationid character varying(50), callingstationid character varying(50), acctterminatecause character varying(32), servicetype character varying(32), xascendsessionsvrkey character varying(10), framedprotocol character varying(32), framedipaddress inet, acctstartdelay integer, acctstopdelay integer, freesidestatus character varying(32), CONSTRAINT radacct_pkey PRIMARY KEY (radacctid) ) WITH (OIDS=FALSE); ALTER TABLE radacct OWNER TO radius; -- Index: freesidestatus CREATE INDEX freesidestatus ON radacct USING btree (freesidestatus); -- Index: radacct_active_user_idx CREATE INDEX radacct_active_user_idx ON radacct USING btree (username, nasipaddress, acctsessionid) WHERE acctstoptime IS NULL; -- Index: radacct_start_user_idx CREATE INDEX radacct_start_user_idx ON radacct USING btree (acctstarttime, username);

    Read the article

  • Is there a list of language only character regions for UTF-8 somewhere?

    - by Brehtt
    I'm trying to analyze some UTF-8 encoded documents in a way that recognizes different language characters. For my approach to work I need to ignore non-language characters, such as control characters, mathematical symbols etc. Just trying to dissect the basic Latin section of the UTF standard has resulted in multiple regions, with characters like the division symbol being right in the middle of a range of valid Latin characters. Is there a list somewhere that identifies these regions? Or better yet, a Regex that defines the regions or something in C# that can identify the different characters?

    Read the article

  • How to correct character encoding in IE8 native json ?

    - by mike_t2e
    I am using json with unicode text, and having a problem with the IE8 native json implementation. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script> var stringified = JSON.stringify("?????? olé"); alert(stringified); </script> Using json2.js or FireFox native json, the alert() string is the same as in the original one. IE8 on the other hand returns Unicode values rather than the original text \u0e2a\u0e27\u0e31\u0e2a\u0e14\u0e35 ol\u00e9 . Is there an easy way to make IE behave like the others, or convert this string to how it should be ? And would you regard this as a bug in IE, I thought native json implementations were supposed to be drop-in identical replacements for json2.js ?

    Read the article

  • Japanese character stored in SQL Server DB using ASP page that assumed it as ISO-8859-1 encoding

    - by Vishal Seth
    We have a legacy ASP based product that allowed the UI and Data languages of user groups to be configured according to their locations. CodePage and CharSet in ASP pages collecting data was set accordingly. I've noticed few instances in the SQL Server DB where users posted Japanese characters in the ASP page that assumes the oncoming stream to be of ISO-8859-1/Western and as a result, the data in the SQL table has gobbled up. While upgrading the client to our new product, I want to back-convert those "garbage" Japanese (in some instances Chinese) characters back to their actual form. Can I create some utility ASP page that would go through such data values and "fix" the wrongly-encoded strings and store everything back as utf-8 strings? In any case, I don't want to affect my French/Spanish/English characters that might be there as well.

    Read the article

  • R: How to separate character output in a loop?

    - by John
    I'm blanking on the best way to paste a list of strings together to go into an SQL statement... I'm having trouble with the separator bar | printing at the beginning when I don't want it to: foo = "blah" paste_all_together = NULL for (n in 1:4) { paste_together = paste(foo ,sep = "") paste_all_together = paste(paste_all_together, paste_together, sep = "|") } > paste_all_together [1] "|blah|blah|blah|blah" I just want it to print out "blah|blah|blah|blah". Do I need a nested loop, or is there a better itterator in R for doing this? Or perhaps a better way to input SQL statements?

    Read the article

  • return first non repeating character in a string

    - by Amm Sokun
    I had to solve this question in which given a string, i had to return the first non repeating character present in the string. I solved it using hashtable and wrote a method which takes a constant reference to the string and returns the first non repeating character. However, when there is no non repeating character present in the string, i return -1 and in the main program i check as follows char c = firstNonRepeating( word ); if (static_cast<int> (c) == -1) cout<<"no non repeating character present\n"; else cout<<c<<endl; is that the correct way to return -1 when required character is not present?

    Read the article

  • Table character encoding - exception in application

    - by zgnilec
    I have a code: CREATE TABLE IF NOT EXISTS Person ( name varchar(24) ... ) CHARACTER SET utf8 COLLATE utf8_polish_ci; This works OK in my application, but I read if someone put in name field a string that contains character wchich code is greater than 127, database will use 2 bytes (or more) to store this character. So i think, i will change character set to utf16: CHARACTER SET utf16 COLLATE utf16_polish_ci; But now when I run my application, exception apears: KeyNotFoundException. It apears exactly at these instructions: MySqlCommand komenda = baza.Polaczenie.CreateCommand (); komenda.CommandText = zapytanie; MySqlDataReader dr = komenda.ExecuteReader (); // HERE, at execute reader method if (dr.Read ()) ... 1) Anyone had similar problem? 2) Any idea how to use always 2 bytes/char in database field?

    Read the article

  • How do I read UTF-8 characters via a pointer?

    - by Jen
    Suppose I have UTF-8 content stored in memory, how do I read the characters using a pointer? I presume I need to watch for the 8th bit indicating a multi-byte character, but how exactly do I turn the sequence into a valid Unicode character? Also, is wchar_t the proper type to store a single Unicode character? This is what I have in mind: wchar_t readNextChar (char** p) { char ch = *p++; if (ch & 128) { // This is a multi-byte character, what do I do now? // char chNext = *p++; // ... but how do I assemble the Unicode character? ... } ... }

    Read the article

  • finding character in string C language

    - by iSight
    Hi, I am searching a character at first occurence in string using the following code. But, it is taking some time when the character is too long or the character that i am searching is at far extend, which makes delay in other operations. How could i tackle with this problem. The code is below here. Note: attrPtr is a char* which holds a reference to a string containing '"' character at far extend. int position = 0; char qolon = '"';//character to search while (*(attrPtr + position++) != qolon); char* attrValue = NULL; attrValue = (char*)malloc(position * sizeof(char)); strncpy(attrValue, attrPtr, position-1);

    Read the article

  • Corona SDK - Make a character pass through a platform

    - by Andy Res
    I'm building a game that has a character which should jump up on multiple platforms. The jumping functionality is done, but I would like if the character is just below a platform (static body), when I press the "jump" button, the character should pass through that platform and then sit on it. Right now it collides with the platform, and character cannot jump on it. Do you have any idea how this can be achieved? Right now the platforms are represented by rectangles with "static" body type: local platform = display.newRect( 50, 280, 150, 10 ) platform:setFillColor ( 55, 55, 55) physics.addBody ( platform, "static", {density=1.0, friction=1.0, bounce=0 }) And I was thinking if I could change, or remove the body type of platform when the character collids with it, so he can pass trough platform, but I don't know how to do this, or in general if this will work... maybe there are some built in techniques on how to achieve the effect I want?

    Read the article

  • why am i getting error in this switch statement written in c

    - by mekasperasky
    I have a character array b which stores different identifiers in different iterations . I have to compare b with various identifiers of the programming language C and print it into a file . When i do it using the following switch statement it gives me errors b[i]='\0'; switch(b[i]) { case "if":fprintf(fp2,"if ----> IDENTIFIER \n"); case "then":fprintf(fp2,"then ----> IDENTIFIER \n"); case "else":fprintf(fp2,"else ----> IDENTIFIER \n"); case "switch":fprintf(fp2,"switch ----> IDENTIFIER \n"); case 'printf':fprintf(fp2,"prtintf ----> IDENTIFIER \n"); case 'scanf':fprintf(fp2,"else ----> IDENTIFIER \n"); case 'NULL':fprintf(fp2,"NULL ----> IDENTIFIER \n"); case 'int':fprintf(fp2,"INT ----> IDENTIFIER \n"); case 'char':fprintf(fp2,"char ----> IDENTIFIER \n"); case 'float':fprintf(fp2,"float ----> IDENTIFIER \n"); case 'long':fprintf(fp2,"long ----> IDENTIFIER \n"); case 'double':fprintf(fp2,"double ----> IDENTIFIER \n"); case 'char':fprintf(fp2,"char ----> IDENTIFIER \n"); case 'const':fprintf(fp2,"const ----> IDENTIFIER \n"); case 'continue':fprintf(fp2,"continue ----> IDENTIFIER \n"); case 'break':fprintf(fp2,"long ----> IDENTIFIER \n"); case 'for':fprintf(fp2,"long ----> IDENTIFIER \n"); case 'size of':fprintf(fp2,"size of ----> IDENTIFIER \n"); case 'register':fprintf(fp2,"register ----> IDENTIFIER \n"); case 'short':fprintf(fp2,"short ----> IDENTIFIER \n"); case 'auto':fprintf(fp2,"auto ----> IDENTIFIER \n"); case 'while':fprintf(fp2,"while ----> IDENTIFIER \n"); case 'do':fprintf(fp2,"do ----> IDENTIFIER \n"); case 'case':fprintf(fp2,"case ----> IDENTIFIER \n"); } the error being lex.c:94:13: warning: character constant too long for its type lex.c:95:13: warning: character constant too long for its type lex.c:96:13: warning: multi-character character constant lex.c:97:13: warning: multi-character character constant lex.c:98:13: warning: multi-character character constant lex.c:99:13: warning: character constant too long for its type lex.c:100:13: warning: multi-character character constant lex.c:101:13: warning: character constant too long for its type lex.c:102:13: warning: multi-character character constant lex.c:103:13: warning: character constant too long for its type lex.c:104:13: warning: character constant too long for its type lex.c:105:13: warning: character constant too long for its type lex.c:106:13: warning: multi-character character constant lex.c:107:13: warning: character constant too long for its type lex.c:108:13: warning: character constant too long for its type lex.c:109:13: warning: character constant too long for its type lex.c:110:12: warning: multi-character character constant lex.c:111:13: warning: character constant too long for its type lex.c:112:13: warning: multi-character character constant lex.c:113:13: warning: multi-character character constant lex.c: In function ‘int main()’: lex.c:90: error: case label does not reduce to an integer constant lex.c:91: error: case label does not reduce to an integer constant lex.c:92: error: case label does not reduce to an integer constant lex.c:93: error: case label does not reduce to an integer constant lex.c:94: warning: overflow in implicit constant conversion lex.c:95: warning: overflow in implicit constant conversion lex.c:95: error: duplicate case value lex.c:94: error: previously used here lex.c:96: warning: overflow in implicit constant conversion lex.c:97: warning: overflow in implicit constant conversion lex.c:98: warning: overflow in implicit constant conversion lex.c:99: warning: overflow in implicit constant conversion lex.c:99: error: duplicate case value lex.c:97: error: previously used here lex.c:100: warning: overflow in implicit constant conversion lex.c:101: warning: overflow in implicit constant conversion lex.c:102: warning: overflow in implicit constant conversion lex.c:102: error: duplicate case value lex.c:98: error: previously used here lex.c:103: warning: overflow in implicit constant conversion lex.c:103: error: duplicate case value lex.c:97: error: previously used here lex.c:104: warning: overflow in implicit constant conversion lex.c:104: error: duplicate case value lex.c:101: error: previously used here lex.c:105: warning: overflow in implicit constant conversion lex.c:106: warning: overflow in implicit constant conversion lex.c:106: error: duplicate case value lex.c:98: error: previously used here lex.c:107: warning: overflow in implicit constant conversion lex.c:107: error: duplicate case value lex.c:94: error: previously used here lex.c:108: warning: overflow in implicit constant conversion lex.c:108: error: duplicate case value lex.c:98: error: previously used here lex.c:109: warning: overflow in implicit constant conversion lex.c:109: error: duplicate case value lex.c:97: error: previously used here lex.c:110: warning: overflow in implicit constant conversion lex.c:111: warning: overflow in implicit constant conversion lex.c:111: error: duplicate case value lex.c:101: error: previously used here lex.c:112: warning: overflow in implicit constant conversion lex.c:112: error: duplicate case value lex.c:110: error: previously used here lex.c:113: warning: overflow in implicit constant conversion lex.c:113: error: duplicate case value lex.c:101: error: previously used here

    Read the article

  • iPhone SDK - Comparing characters in string

    - by Karl Daniel
    Basically what I'm trying to do is compare 2 strings one from a plist and one from the user's input. I use a while loop to step through each character and compare it and if true then I increase an integer then once the loop has finished I work out the percentage correct / similarity of the plist answer and the user's answer. I seem to be having a problem however as the only return I'm getting is 0. Below is the code I'm using... The code below is all functioning and the question no longer requires answering... Working code... answerLength = boxAnswer.length; //Gets number of characters of first string. plistLength = plistAnswer.length; //Gets number of characters of second string. characterRange = 0; //Sets the variable for which character to look at. charactersCorrect = 0; //Sets the variable of number of matching characters. unichar answerCharacter; //Declares a unichar for the first string. unichar plistCharacter; //Declares a unichar for the second string. while (answerLength > 0 && plistLength > 0) { answerCharacter = [boxAnswer characterAtIndex:characterRange]; //Gets character of first string at the index of the range integer. plistCharacter = [plistAnswer characterAtIndex:characterRange]; //Gets character of second string at the index of the range integer. answerLength--; //Reduces number of characters left to compare. plistLength--; characterRange++; //Increases integer to tell it to look at next character in string. if (answerCharacter == plistCharacter) { //Checks to see if character of first string and character of second string match. charactersCorrect++; //If true increases the number correct. } } //Works out percentage of matching characters out of the total string. totalChar = plistAnswer.length; totalPercentage = (charactersCorrect/totalChar)*100; percentageCorrect.text = [NSString stringWithFormat:@"%i%%",totalPercentage]; Variable Declarations... int answerLength; int plistLength; int characterRange; double totalChar; double charactersCorrect; int totalPercentage;

    Read the article

  • ArrayList in Java [on hold]

    - by JNL
    I was implementing a program to remove the duplicates from the 2 character array. I implemented these 2 solutions, Solution 1 worked fine, but Solution 2 given me UnSupportedoperationException. I am wonderring why i sthat so? The two solutions are given below; public void getDiffernce(Character[] inp1, Character[] inp2){ // Solution 1: // ********************************************************************************** List<Character> list1 = new ArrayList<Character>(Arrays.asList(inp1)); List<Character> list2 = new ArrayList<Character>(Arrays.asList(inp2)); list1.removeAll(list2); System.out.println(list1); System.out.println("*********************************************************************************"); // Solution 2: Character a[] = {'f', 'x', 'l', 'b', 'y'}; Character b[] = {'x', 'b','d'}; List<Character> al1 = new ArrayList<Character>(); List<Character> al2 = new ArrayList<Character>(); al1 = (Arrays.asList(a)); System.out.println(al1); al2 = (Arrays.asList(b)); System.out.println(al2); al1.removeAll(al2); // retainAll(al2); System.out.println(al1); }

    Read the article

  • insert null character using tamper data

    - by Jeremy Comulu
    Using the firefox extension tamper data (for modifing http requests that firefox makes) how do I insert a null character into a post field? I can enter normal characters, but binary characters in it are not urlencoded and are shown as is, so how do I enter the null character into a field? If you know of a firefox extension like tamper data that I can do this or a way to do this using tamper data please post.

    Read the article

  • How do I change a character embedded in filenames to another character?

    - by PilotMom
    in a directory with multiple sub directories I need to change filenames that have the "_" character to a another character "." example Current filename: ABC12345_DEF Change to filename: ABC12345.DEF I need to do this recursively through a directory tree. the last three characters of the filename are not always the same. using rename wildcards on either side of the "_" or "." doesn't work (plus I need to do this through several directories)

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >