Search Results

Search found 658 results on 27 pages for 'sprites'.

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

  • targeting sprites from a method in the document class - null object reference

    - by Freddyk
    Hi I am trying to code a flash app entirely in the document class. I am using GestureWorks with a touch screen. When a user essentially presses a button it calls a method that should hide a specific graphic but not the graphic they touched. Essentially I need a way to refer to a graphic on the screen using a method besides 'e.target'. //This code works because it can access 'e.target'. private function photo1SpriteFlickHandler(e:GestureEvent):void { var openTween:Tween = new Tween(e.target, "x", Strong.easeOut, 232, 970, 5, true); } //this code gives me a null object reference because I am using 'photo1Sprite' rather than 'e.target' private function photo1SpriteFlickHandler(e:GestureEvent):void { var openTween:Tween = new Tween(photo1Sprite, "x", Strong.easeOut, 232, 970, 5, true); } //photo1Sprite has already been programatically added to the screen as so: var photo1Sprite = new TouchSprite(); var photo1Loader=new Loader(); photo1Loader.load(new URLRequest("media/photos1/photo1.jpg")); photo1Loader.contentLoaderInfo.addEventListener(Event.COMPLETE,loaderComplete); photo1Sprite.x = 232; photo1Sprite.y = 538; photo1Sprite.scaleX = .3; photo1Sprite.scaleY = .3; photo1Sprite.blobContainerEnabled = true; photo1Sprite.addEventListener(TouchEvent.TOUCH_DOWN, startDrag_Press); photo1Sprite.addEventListener(TouchEvent.TOUCH_UP, stopDrag_Release); photo1Sprite.addChild(photo1Loader); addChild(photo1Sprite); So I can make photo1Sprite react if my method is attached to it directly using 'e.target' but not if I am trying to call it from a method that was called from another element on the screen.

    Read the article

  • [XNA] Forming bounding box only around visible sprites

    - by nadalian
    Hi, this site has been really amazing for helping me with game development however I'm unable to find an answer for the following question (nor am I able to solve it on my own). I am trying to do rectangle collision in my game. My idea is to 1) get the original collision bounding rectangle 2) Transform the texture (pos/rot/scale) 3) Factor changes of item into a matrix and then use this matrix to change the original collision bounds of the item. However, my textures contain a lot of transparency, transparency that affect the overall height/width of the texture (I do this to maintain power of two dimensions). My problem: How to create a rectangle that forms dimensions which ignore transparency around the object. A picture is provided below: http://img51.imageshack.us/img51/4772/boundingbox.png

    Read the article

  • Replacing image in sprite - cocos2d game development of iphone

    - by sagar
    I want to change the sprite image. Say for example. mainSprite=[Sprite spriteWithFile:@"redFile.png"]; [self addChild:mainSprite]; Here, Sprite is already added to a layer. I have mainSprite (pointer) which can access it. If I change [mainSprite setOpacity:150]; it works perfectly. But Here I want to change the sprite image instead of opacity. But Don't know how? Thanks in advance for helping me. Sagar

    Read the article

  • print CSS still showing some background images when printing

    - by RyanP13
    I am receiving some strange begaviour in IE6 when printing a page. For some reason it is printing out parts of a CSS background image sprite. I have overridden all background-image declarations with: * {background-image:none !important;} But to no avail. I didn't think background images were supported by default anyways so this is a new one on me.

    Read the article

  • Sprite Fallback

    - by MontyBongo
    I have a number of images on a page contained within a single sprite image, these images must be contained within the single sprite due to other requirements of the site. Whilst this is working fine in most browsers I have an issue on Opera Mini where it is not rendering the sprite at all and just displaying the whole image. Is there any CSS that can be used to provide a text alternative when the browser is unable to render the sprite?

    Read the article

  • Background-position in css

    - by Mubeen
    Can we use more than 2 images for single navigation. That means when we hover on that image it will shows 6 different images. Is it possible to make for a single navigation image? If possible means how? I think you are all understand this

    Read the article

  • css sprite button is jumping around

    - by Richard
    Hello everyone, Does anyone know what is causing the sprite rollover to jump around It is I think more likely a photoshop question, but I am not completely sure. I hope to get an answer here anyway, since I think most webdesigners/programmers problably worked with photoshop also. This is what I want the rollover to do example 1 and this is my testpage (see the play button) I made the sprite with spriteme.com thanks, Richard

    Read the article

  • a:hover background-postition problem

    - by Ryan
    For some reason, I am not entirely sure why, but the following is not working. The background position simply stays the same on hover. I cannot figure out why. I could do it another way, but I would like to try and get to the bottom of why it does not work. #nav a:link, #nav a:visited { background:url(../img/nav-sprite.png) no-repeat; display:block; float:left; height:200px; padding:10px; text-indent:-9999px; border:solid 1px red; } #nav a#home { background-position:-10px 0px; width:30px; } #nav a#about-us { background-position:-85px 0px; width:45px; } #nav a:hover { background-position:1px -15px; } Does anybody know what could be causing this? Thanks in advance! Ryan

    Read the article

  • Programming graphics and sound on PC - Total newbie questions, and lots of them!

    - by Russel
    Hello, This isn't exactly specifically a programming question (or is it?) but I was wondering: How are graphics and sound processed from code and output by the PC? My guess for graphics: There is some reserved memory space somewhere that holds exactly enough room for a frame of graphics output for your monitor. IE: 800 x 600, 24 bit color mode == 800x600x3 = ~1.4MB memory space Between each refresh, the program writes video data to this space. This action is completed before the monitor refresh. Assume a simple 2D game: the graphics data is stored in machine code as many bytes representing color values. Depending on what the program(s) being run instruct the PC, the processor reads the appropriate data and writes it to the memory space. When it is time for the monitor to refresh, it reads from each memory space byte-for-byte and activates hardware depending on those values for each color element of each pixel. All of this of course happens crazy-fast, and repeats x times a second, x being the monitor's refresh rate. I've simplified my own likely-incorrect explanation by avoiding talk of double buffering, etc Here are my questions: a) How close is the above guess (the three steps)? b) How could one incorporate graphics in pure C++ code? I assume the practical thing that everyone does is use a graphics library (SDL, OpenGL, etc), but, for example, how do these libraries accomplish what they do? Would manual inclusion of graphics in pure C++ code (say, a 2D spite) involve creating a two-dimensional array of bit values (or three dimensional to include multiple RGB values per pixel)? Is this how it would be done waaay back in the day? c) Also, continuing from above, do libraries such as SDL etc that use bitmaps actual just build the bitmap/etc files into machine code of the executable and use them as though they were build in the same matter mentioned in question b above? d) In my hypothetical step 3 above, is there any registers involved? Like, could you write some byte value to some register to output a single color of one byte on the screen? Or is it purely dedicated memory space (=RAM) + hardware interaction? e) Finally, how is all of this done for sound? (I have no idea :) )

    Read the article

  • Why doesn't this image sprite menu display properly, and why aren't the links working?

    - by briligg
    The code validates. There should be two more images in the menu on the left, above the visible one of the silo. And each should be a link. http://www.briligg.com/agnosticism.html css is: external style sheet: .menu { position: relative; float: left; margin: 10px; padding: 0; width: 150px; } .menu li { margin: 0; padding: 0; list-style: none; position: absolute; left: 0; top: 260px; } .menu li, .menu a { width: 150px; height: 150px; } internal style sheet: .menu { height: 450px; } .mirror { top: 0; } .mirror { background: url(http://www.briligg.com/images/menu-ag.png) 0 0; } .wormcan { top: 151px; } .wormcan { background: url(http://www.briligg.com/images/menu-ag.png) 0 -151px; } .wormsilo { top: 301px; } .wormsilo { background: url(http://www.briligg.com/images/menu-ag.png) 0 -301px; } html: <ul class="menu"> <li class="mirror"> <a href="whoryou.html"></a> </li> <li class="wormcan"> <a href="aroundyou.html"></a> </li> <li class="wormsilo"> <a href="beyondyou.html"></a> </li> </ul>

    Read the article

  • Sprite not moving when using a function from another class SFML c++

    - by user2892932
    I have a Game.cpp, and I am calling a update function in my Player class. In my player update Function I have it to check for keyboard input, and it seems to work, but whenever I try to call the .move() function, it seems to not work. I get no errors either. I am new to sfml, and decent with c++. Help is appreciated! #include "Player.h" Player::Player(void): vel(0), maxvel(100) { Load("Assets/sss.png",true); } void Player::Update(sf::Sprite& p) { if (sf::Keyboard::isKeyPressed(sf::Keyboard::A)) { moveObject(-3,0, p); } if(sf::Keyboard::isKeyPressed(sf::Keyboard::D)) { moveObject(-3,0, p); } } Player::~Player(void) { } This is the GameObject cpp #include "GameObject.h" #include <iostream> GameObject::GameObject(void) { isLoaded = false; } void GameObject::Load(std::string flname, bool isPlayer) { if(!tex.loadFromFile(flname)) { EXIT_FAILURE; } else { if(isPlayer) { if(!tex.loadFromFile(flname, sf::IntRect(0,0,33,33))) { EXIT_FAILURE; } else { std::cout << "Loading image" << "\n"; filename = flname; spr.setTexture(tex); isLoaded = true; } } else { std::cout << "Loading image" << "\n"; filename = flname; spr.setTexture(tex); isLoaded = true; } } } void GameObject::Draw(sf::RenderWindow & window) { if(isLoaded) { window.draw(spr); window.display(); std::cout << "Sprite drew" << "\n"; } } void GameObject::setPos(float x, float y) { if(isLoaded) { spr.setPosition(x,y); } } sf::Vector2f GameObject::GetObjPos() { return spr.getPosition(); } sf::Sprite& GameObject::getSprite() { return spr; } void GameObject::moveObject(float x, float y, sf::Sprite& sp) { sp.move(x, y); } GameObject::~GameObject(void) { }

    Read the article

  • Image sprite not lining up in firefox

    - by Saif Bechan
    I am working with an image sprite to create my buttons. They work right in every browser except firefox. Lets say i have 2 spans next to eachother: <span class="spanleft"></span><span class="spanright"></span> and give them some styling(this is the actual code i use for the sprite) .spanleft{ background:url('/templates/default/img/auction/btn-toolbar.png') no-repeat 0 0; display:block; float:left; height:100px; width:13px; } .spanright{ background:url('/templates/default/img/auction/btn-toolbar.png') no-repeat 0 -104px; display:block; float:left; height:100px; width:30px; margin-left:0px; } Now this works in every browser i tested, the images line up great. But in firefox I get a small offset. Now i fiddled with the pixels a lot. Its not an offset of 1px, the offset is about 0.5 of a px. yeah. Ive made a screenshot of what i mean, and i'm going to put in the sprite for the buttons, they make lovely buttons, upstate,downstate,hover,disabled. You can use them in your projects. Here are the shots: This is the problem: Here is the image sprite: I hop this problem can be solved, i am working with FF 3.6. thanks guys!

    Read the article

  • Why is my background image not displaying properly in IE7?

    - by JAG2007
    Screenshot of the issue: here Webpage in Question: http://cure.org Offending browser: Internet Explorer 7 You'll notice from the screenshot, or if you view this site in IE7, that the background image is not displaying for the content div (#modal-inner-content). Strangely, the image displays in the other divs where it is used (since it's a sprite, I'm using that same image for #modal-top-border and #modal-btm-border). In all other browsers it displays properly, and even in IE8. I cannot seem to find what CSS rule (or lack thereof) I may be using that IE7 is choking on. NOTE: in order to get the modal screen, just click the link at the very top banner of the page that says "login to your CURE account

    Read the article

  • Is it possible to extract textures or sprites from compiled game files?

    - by Brian Reindel
    For instance, every map in Portal has what appear to be sprites over a texture indicating the obstacles you'll face (see screenshot). Are these resources compiled into the source as byte code, or is it possible to extract them from installation files? Obviously I understand copyright implications, and I am only interested in using it for a recreational project. Instead of recreating them, I wonder if they can be extracted.

    Read the article

  • How do I detect multiple sprite collisions when there are >10 sprites?

    - by yao jiang
    I making a small program to animate the astar algorithm. If you look at the image, there are lots of yellow cars moving around. Those can collide at any moment, could be just one or all of them could just stupidly crash into each other. How do I detect all of those collisions? How do I find out which specific car has crash into which other car? I understand that pygame has collision function, but it only detects one collision at a time and I'd have to specify which sprites. Right now I am just trying to iterate through each sprite to see if there is collision: for car1 in carlist: for car2 in carlist: collide(car1, car2); This can't be the proper way to do it, if the car list goes to a huge number, a double loop will be too slow.

    Read the article

  • How to create a 3D world with 2D sprites similar to Ragnorak online?

    - by Romoku
    As far as I know Ragnorak Online is a 3D game world with 2D sprites overlayed. I would like to use this style in a game I am making in Unity, so I would like the player to be able to select little square tiles on the terrain. There are a couple routes I could take such as using a bunch of cubic polygons and linking them together or using one big map. The former approach doesn't seem to make any sense if the world is not flat as polygons wouldn't be reused often. The goal is to break down a 3D polygon into tiles which is heard to wrap my head around. I believe using something like an interval tree or array would be appropriate to store the rectangle grid, but how would I display a rectangle around the selection the player has his mouse over on the polygon terrain itself? Here is a screenshot. Here is a gameplay video. Here is the camera usage.

    Read the article

  • How to create a "retro" pixel shader for transformed 2D sprites that maintains pixel fidelity?

    - by David Gouveia
    The image below shows two sprites rendered with point sampling on top of a background: The left skull has no rotation/scaling applied to it, so every pixel matches perfectly with the background. The right skull is rotated/scaled, and this results in larger pixels that are no longer axis aligned. How could I develop a pixel shader that would render the transformed sprite on the right with axis aligned pixels of the same size as the rest of the scene? This might be related to how sprite scaling was implemented in old games such as Monkey Island, because that's the effect I'm trying to achieve, but with rotation added. Edit As per kaoD's suggestions, I tried to address the problem as a post-process. The easiest approach was to render to a separate render target first (downsampled to match the desired pixel size) and then upscale it when rendering a second time. It did address my requirements above. First I tried doing it Linear -> Point and the result was this: There's no distortion but the result looks blurred and it loses most of the highlights colors. In my opinion it breaks the retro look I needed. The second time I tried Point -> Point and the result was this: Despite the distortion, I think that might be good enough for my needs, although it does look better as a still image than in motion. To demonstrate, here's a video of the effect, although YouTube filtered the pixels out of it: http://youtu.be/hqokk58KFmI However, I'll leave the question open for a few more days in case someone comes up with a better sampling solution that maintains the crisp look while decreasing the amount of distortion when moving.

    Read the article

  • Can't use the hardware scissor any more, should I use the stencil buffer or manually clip sprites?

    - by Alex Ames
    I wrote a simple UI system for my game. There is a clip flag on my widgets that you can use to tell a widget to clip any children that try to draw outside their parent's box (for scrollboxes for example). The clip flag uses glScissor, which is fed an axis aligned rectangle. I just added arbitrary rotation and transformations to my widgets, so I can rotate or scale them however I want. Unfortunately, this breaks the scissor that I was using as now my clip rectangle might not be axis aligned. There are two ways I can think of to fix this: either by using the stencil buffer to define the drawable area, or by having a wrapper function around my sprite drawing function that will adjust the vertices and texture coords of the sprites being drawn based on the clipper on the top of a clipper stack. Of course, there may also be other options I can't think of (something fancy with shaders possibly?). I'm not sure which way to go at the moment. Changing the implementation of my scissor functions to use the stencil buffer probably requires the smallest change, but I'm not sure how much overhead that has compared to the coordinate adjusting or if the performance difference is even worth considering.

    Read the article

  • how to generate random bubbles from array of sprites in cocos2d?

    - by prakash s
    I am devoloping the bubble shooter game in cocos2d how to generate random bubbles from array of sprites here is my code (void)addTarget { CGSize winSize = [[CCDirector sharedDirector] winSize]; //CCSprite *target = [CCSprite spriteWithFile:@"3.png" rect:CGRectMake(0, 0, 256, 256)]; NSMutableArray * movableSprites = [[NSMutableArray alloc] init]; NSArray *images = [NSArray arrayWithObjects:@"1.png", @"2.png", @"3.png", @"4.png",@"5.png",@"1.png",@"5.png", @"3.png", nil]; for(int i = 0; i < images.count; ++i) { NSString *image = [images objectAtIndex:i]; // generate random number based on size of array (array size is larger than 10) CCSprite*target = [CCSprite spriteWithFile:image]; float offsetFraction = ((float)(i+1))/(images.count+1); target.position = ccp(winSize.width*offsetFraction, winSize.height/2); target.position = ccp(350*offsetFraction, 460); [self addChild:target]; [movableSprites addObject:target]; //[target runAction:]; id actionMove = [CCMoveTo actionWithDuration:10 position:ccp(winSize.width/2,winSize. height/2)]; This code generating bubbles with *.png colour bubbles but i want to generate randomly because for shooting the bubbles by shooter class help me please id actionMoveDone = [CCCallFuncN actionWithTarget:self selector:@selector(spriteMoveFinished:)]; [target runAction:[CCSequence actions:actionMove, actionMoveDone, nil]]; } }

    Read the article

  • How to create array with unique sprites? in cocos2d iphone

    - by prakash s
    I write the code like this. This displays only one sprite (red colour bubble) with number of times and moving down, but actually I want to display different sprites (different colour bubble) every time and moving down. I also add no of .png images in resource folder of my project. Here I used only 3.png, but I need to display all *.png images (different colour bubbles) in my project but I don't know how to get this. Please help me Thank you. Here is the code: -(void)addTarget { CCSprite *target = [CCSprite spriteWithFile:@"3.png" rect:CGRectMake(0, 0, 256, 256)]; CGSize winSize = [[CCDirector sharedDirector] winSize]; int minY = target.contentSize.height/2; int maxY = winSize.height - target.contentSize.height/2; int rangeY = maxY - minY; int actualY = (arc4random() % rangeY) + minY; // Create the target slightly off-screen along the right edge, // and along a random position along the Y axis as calculated above target.position = ccp(winSize.width + (target.contentSize.width/2), actualY); [self addChild:target]; // Determine speed of the target int minDuration = 4.0; int maxDuration = 12.0; int rangeDuration = maxDuration - minDuration; int actualDuration = (arc4random() % rangeDuration) + minDuration; // Create the actions id actionMove = [CCMoveTo actionWithDuration:actualDuration position:ccp(-target.contentSize.width/2,actualY)]; id actionMoveDone = [CCCallFuncN actionWithTarget:self selector:@selector(spriteMoveFinished:)]; [target runAction:[CCSequence actions:actionMove, actionMoveDone, nil]]; // Add to targets array target.tag = 2; [_targets addObject:target]; } -(void)gameLogic:(ccTime)dt { [self addTarget]; } -(id) init { if( (self=[super initWithColor:ccc4(255,255,255,255)] )) { // Enable touch events self.isTouchEnabled = YES; // Initialize arrays _targets = [[NSMutableArray alloc] init]; _projectiles = [[NSMutableArray alloc] init]; // Get the dimensions of the window for calculation purposes CGSize winSize = [[CCDirector sharedDirector] winSize]; [self schedule:@selector(gameLogic:) interval:1.0]; [self schedule:@selector(update:)]; } return self; } - (void)update:(ccTime)dt { NSMutableArray *projectilesToDelete = [[NSMutableArray alloc] init]; for (CCSprite *projectile in _projectiles) { CGRect projectileRect = CGRectMake(projectile.position.x - (projectile.contentSize.width/2), projectile.position.y - (projectile.contentSize.height/2), projectile.contentSize.width, projectile.contentSize.height); NSMutableArray *targetsToDelete = [[NSMutableArray alloc] init]; for (CCSprite *target in _targets) { CGRect targetRect = CGRectMake(target.position.x - (target.contentSize.width/2), target.position.y - (target.contentSize.height/2), target.contentSize.width, target.contentSize.height); if (CGRectIntersectsRect(projectileRect, targetRect)) { [targetsToDelete addObject:target]; } } for (CCSprite *target in targetsToDelete) { [_targets removeObject:target]; [self removeChild:target cleanup:YES]; _projectilesDestroyed++; if (_projectilesDestroyed > 30) { //GameOverScene *gameOverScene = [GameOverScene node]; // [gameOverScene.layer.label setString:@"You Win!"]; // [[CCDirector sharedDirector] replaceScene:gameOverScene]; } } if (targetsToDelete.count > 0) { [projectilesToDelete addObject:projectile]; } [targetsToDelete release]; } for (CCSprite *projectile in projectilesToDelete) { [_projectiles removeObject:projectile]; [self removeChild:projectile cleanup:YES]; } [projectilesToDelete release]; }

    Read the article

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