Savlon
  • Member for 9 years
  • Last seen this week
Change the sprite of a Object in Unity
Accepted answer
20 votes

The code has been commented for you. Enjoy. public Sprite sprite1; // Drag your first sprite here public Sprite sprite2; // Drag your second sprite here private SpriteRenderer spriteRenderer; void ...

View answer
How can I make a sprite-sheet-based animation system?
19 votes

The way I do 2D animations is as follows: Sprite Retrieval Class This class can either load an image file or it can load a sprite from a sprite sheet. It's very self explanatory. import java.awt....

View answer
Sidescrolling troubles
Accepted answer
7 votes

Instead of me just giving you the classes and you not knowing what is happening in them, I will provide you with an explanation and run down of what is happening and then you can give it a go yourself....

View answer
How do I calculate how an object will move from one point to another?
Accepted answer
6 votes

Basic trigonometry example cosine for x axis sine for y axis speed is whatever you would like the movement each time to increment by... Obviously the higher the number the more pixels it will move ...

View answer
How do I draw a tilemap within unity3d?
Accepted answer
5 votes

Ok seems as no one is replying to you, I will provide you with a basic commented example. I assume you have a "Resources" folder inside of your "Assets" folder. I also assume you have a "Prefabs" ...

View answer
How to programmatically change sprite sheet sub-sprite name
Accepted answer
4 votes

Ok so based on @Rouze comment regarding the sprite slice renamer, I've managed to mock something up quickly that does the job. Here is the quick mockup I did if anyone else is looking for a quick and ...

View answer
Removing the titlebar while using slick2d?
3 votes

Ok so here is a basic application that has the title bar removed public static void main(String[] args){ JFrame frame = new JFrame("Without Title Bar Frame"); frame.setUndecorated(true); ...

View answer
How to load sprite from JSON?
2 votes

Expanded post on comment:"JSON is just a means of storing text information right? Why not just hold a path to the sprite in the JSON file? Then whenever you obtain the information in the JSON file, ...

View answer
App Programming Question: Converting Code and Project Folders for the Smartphone's OS Compatibility
2 votes

Quote from http://docs.xamarin.com/ios/Guides/Application_Fundamentals/Building_Cross_Platform_Applications Rarely does an organization have the luxury of building mobile apps for a single mobile ...

View answer
SpriteSheet in slick2d or lwjgl
Accepted answer
2 votes

Was wondering is this faster, than the method above. It would have been better for you to post the SpriteSheet.java class from slick2D so we could compare them. I couldn't find the actual code to ...

View answer
Java game Inventory problem
1 votes

Assuming you have a class named Slot. Public class Slot { Public Item item; Public bool IsEmpty () { If (item == null) Return true; Return false; } } ...

View answer
2D C# Collecting Item For Acceleration Unity
Accepted answer
1 votes

You can use Mathf.Lerp. Mathf.Lerp takes in 'From', 'To' and 'T' parameters. It interpolates your value From to To over T. The T parameter should be a value between 0 and 1. 0 is equal to your From ...

View answer
How can you have the Input Manager Axis values snap to 1 (or -1)?
Accepted answer
1 votes

Input.GetAxisRaw("Horizontal"); Reference: http://docs.unity3d.com/ScriptReference/Input.GetAxisRaw.html If you are wanting the value to be -1, 0 or 1, use GetAxisRaw for keyboard inputs.

View answer
Unable to instantiate objects Straight in unity
1 votes

I don't know if this helps you but this is a nested for loop that places a prefab object at an x and y location. The cardAmountX can be changed to whatever amount you want and it basically sets the ...

View answer
Slick UnicodeFont displays in different location depending on the screen size?
Accepted answer
1 votes

Ok so I haven't used slick2d for a long time but basically you need to find the screens width and height and then divide them by 2 like so... Paste these at the top of the class in the public ...

View answer
Can't edit specific variables from the inspector panel, while variable is static
1 votes

Yeh you can't create a static variable and have it accessible from the inspector panel that I know of. However, you could try this In your class that has the editable variable you could create a ...

View answer
animation runs only onces
1 votes

I answered that post you are referring to... You need to create a Boolean like so: private boolean loop; And replace If (currentFrame > totalFrames - 1) With If (currentFrame > ...

View answer
Recommended collision response needed
Accepted answer
1 votes

Ok so i'll post this in an answer to try and help you. I'll write this in java. However, you could easily convert it to C# Your entity classes will look something like this public class Entity { ...

View answer
How can I move an enemy towards a player in AndEngine?
1 votes

Get the difference in positions on the x and y axis and use Pythagorean theorem to calculate the length double dx = player.x - enemy.x; double dy = player.y - enemy.y; double length = Math.sqrt(dx * ...

View answer
Images not rendering in Slick
1 votes

Ok so lets get to it! Paste the code where you call your first map to initialise. Do you use the setMap() method to initialise your first map? or do you have map = new TiledMap("blah");?? If you can'...

View answer
Circle Collision class not positioning itself correctly
1 votes

Ok so I dont really program in c#. However, I've had this problem once before and realised that I had added the radius of the circle to the x and y position which offsets the collision circle from the ...

View answer
Objects stick together on Collision
Accepted answer
0 votes

As requested by SanSolo - Comment converted to answer. If you are calling the AddForce method from OnCollisionEnter2D then it will only get called on the initial contact of both colliders. If for ...

View answer
Getting a pixel of Sprite at the cursor position in Unity
0 votes

Below I've posted something I mocked up going for deformable pixel terrain. You may be able to get something from it... You may not... Either way, It can obtain the pixels of an image around the mouse ...

View answer
Can someone explain to me the difference between 2 XNA methods?
Accepted answer
0 votes

Assuming "LoadContent" gets called once at startup and "Update" gets called every frame, your issue is probably because the ball's X and Y coordinate got set to 5 every frame in the update method, ...

View answer
Creating a BufferedImage with several smaller images?
Accepted answer
0 votes

Why not add double buffering to everything drawn in your game? This is the way I would do it... you would declare 2 variables in your main game class like so: private Graphics g; private ...

View answer
Repeat image on a fixed background, Cocos2D?
0 votes

Something along the lines of this... NOTE: I have minimal knowledge of cocos2d/objective c This is a nested for loop, If you would like to access data from each image at a later stage i'd suggest ...

View answer
Parallax With Box2d iphone
Accepted answer
0 votes

No one is going to write your code for you, there are plenty of tutorials out there for cocos2d and box2d so i suggest you read them. Are you using tileD? Or are you just using a picture as a ...

View answer
How to create Elastic rope / Rubber band in box2d?
Accepted answer
0 votes

No one will write the code for you so I think you would be hard up getting an answer. Luckily for you I searched for a tutorial for creating rope with box2d and cocos2d on google and found this really ...

View answer