Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
so I'm trying to make 2.5D game and I want to make that players could hide behind objects (like walls, fountains, other players which are closer to camera).
Preview of what i'm tying to say:
So I want to ask some suggestions/help how could I do it ?
This seems like a very vague question but a basic idea will be manipulation of the background and foreground. You will need to be able to change where your character falls and whether or not the an object can be both foreground or background. If they can be both then you could declare that as a object that could be hidden behind.
I propose some solution that you could try :
with libgdx to draw an Object1 before an other Object2 you just render the object1 and then render the Object2 but to manipulate distance like you want to do, you should try to use Masking with Depth buffer
see an example in the officiel docs
https://github.com/mattdesl/lwjgl-basics/wiki/LibGDX-Masking
also not very efficient but you could try :
I once try to make some object look in the background comparing to each other, so i played with their opacity color, it worked fine for what I needed
hope that was helpful good luck
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
i'm making a den designing game of sorts
but i can't find anything that would help me create a ui that can allow the player to move the desired png/pngs up and down a layer. So say the player has a "flower pot" and they want to move the png of the flower pot behind the png of the "bed". How can i create this function?
http://www.agame.com/game/My-New-Room
like in this game at the bottom
they have arrows that move the png up and down,
thank you for your help in advance!
https:// jsfiddle.net/okcjt5vf/294/ this is all my code so far.
Just a high level example:
This would, on click of an element with class .adjustableElement, cause the z-index to increase by one on the element.
$(".adjustableElement").click(function() {
let newIndex = parseInt(this.css('z-index')) + 1;
this.css('z-index', newIndex);
});
In your case, you will need to define a variable selectedElement to the png/image in question (However you decide this, by clicking on it etc.). Then, you will have two functions, one to raise one to lower depending on the arrow they action.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Say a webpage renders a realistic world map, so the countries have jagged borders. To my knowledge, it would be next to impossible to draw divs that exactly match the country shapes using common CSS.
Is it possible to make the individual countries clickable, exactly following the borders?
For this you would use the HTML <map> element. This essentially requires that you have a static image, because you have to specify each point in an area.
http://www.w3schools.com/tags/tag_map.asp
A map element has the map name and is comprised of area child elements.
http://www.w3schools.com/tags/tag_area.asp
For arbitrarily shaped area, you would use shape="poly" and put in the x- and y- coordinates for each point.
http://www.w3schools.com/tags/att_area_coords.asp
It is also possible to use what's known as a server-side image map, though these have fallen out of fashion. These are more complicated, require a scripting language on the backend, and are considered less accessible than client-side maps. They were popular in the early days of the web.
you can use this but once you doit you cant resize the image or the map wont fit properly.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Is it better to use image sprites for CSS or use a lot of different image files?
Maybe it is better to use a lot of different images rather than one sprite or vice versa?
As typical website contains multiple css, java script and image files,causing browser to request multiple http requests. By using sprite it causes less http requests (good for webserver and client/user), and so page will be load fast (good for client/user)
Put everything in 1 sprite, so only 1 request is needed.
EDIT
Actually it's best to put everything that's related on the same sprite, for example a sprite with forum images, a sprite with homepage images, ...
Since you don't need the forum images on the homepage. (-> reduce size of request)
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm currently working on a game in ActionScript 3 (using FlashPunk) and due to FP's limitation in handling input (~, ^, ã and so on) I ended up having to use AS 3's native TextField class. Through that I capture text, send it to one of my entities in FlashPunk and have it render the text as a graphic (for a text balloon).
My question is: is there a way to make the TextField object invisible yet still interactable?What I want to do is: make the TextField object have focus without the user having to click on it (and it cannot appear on the screen, nor its text, but it must capture the typed text). Is it do-able through sheer code? Thanks in advance.
You can do this via stage.focus = textFieldInstance; (adobe reference). As for making it invisible...
All sorts of tricks are available for this
moving the textfield off screen
hiding the textfield behind something else
textfield.width = 0
setTextFormat with a font that has a size of 0...
There is, of course, also textField.visible = false, but there's a lot of things associated with that that will break what we're trying to achieve.
Whilst googling I found some cases of people having trouble with just using stage.focus however, so if that doesn't work, try this (original source):
myTF.type="input";
myTF.text=" "; //a SPACE or temp "foo" text, but NOT empty !
myTF.stage.focus = myTF;
myTF.setSelection(myTF.length,myTF.length);
myTF.text = "";
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I need to make a really complicated diagram for a website, in which the hierarchy will be a bit messy: arrows will go up and down, sometimes an element will point to several others, and sometimes there will be several elements pointing to the same one. I have found this method, but it doesn't allow more than one parent for an element and therefore won't do the trick in this case.
It has to be done in HTML/CSS, because my intention is to add some Javascript to change the content of the blocks dinamically.
This is an example of the level of complexity I need to achieve:
You might want to take a look at this
http://thecodeplayer.com/walkthrough/css3-family-tree
Another to look for is SpaceTree example by "Nicolas Garcia Belmonte" but not a pure CSS solution. It is compatible with IE and most of browsers. Definitely worth a try.