Hello Guest

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - DemiGoth

Pages: [1] 2 3
Support / Re: TextMesh size in pixels
« on: May 27, 2015, 10:47:37 am »
Yup thats it. Its not 100% accurate as the name suggests but its very very close :)
Close enough for me. Just add an extra 10px and it should be fine (I hope  ;) )

Support / Re: TextMesh size in pixels
« on: May 24, 2015, 08:01:50 am »
Nvm, got it figured out -> GetEstimatedMeshBoundsForString(string str). And from the looks of it, it's quite accurate as well. Now it's time to get building the ticker I want to make ;-)

Support / TextMesh size in pixels
« on: May 23, 2015, 03:26:34 pm »
I'm looking for a way to calculate the size in pixels of a TextMesh. I know that fonts like Courier have a fixed width, but others like Times New Roman don't. It's for those fonts that I need to know the length in pixels of the text written...

Support / Re: How to change the alpha of a "Sprite from texture".
« on: February 26, 2014, 07:38:14 am »
Thank you...

I've figured it out - After learning how to make it was pretty easy actually.

Care to share your solution? I'm in need of some alpha transforming as well ;)


Found it myself as well -> myObject.color= new Color32(0,0,0,128); // Black & half-transparent Using it to gray-out non essential menu objects....

Support / Google's Admob plugin & 2D toolkit
« on: February 20, 2014, 05:44:54 am »
Simple question if they are compatible with each other. I have tried to get it working for Android, but the Admob plugin does get called (I see debug information when I play in the editor), but I never see an ad on my Android phone

It is already two sprites of course, the knife is its own sprite while the rope is a tiled sprite

What you've said is exactly the same as what I said except just reversed. Even if I keep the anchor of the rope on the knife I still need to extend the dimension.x value but in relation to the character instead of the knife.

Uhm, now I look at it again, you're right (was pretty tired earlier today  :-\ ).

Okay, algorithm then (not programming, just working it out in words leaving the programming to you :D )

Calculate distance between char.x and knife.x. In the middle drop the rope sprite and set rope.x length to knife.x-char.x  (there's a special distance function for it in Vector iirc - makes it easier when you can throw the knife over the y-axis as well).

I think the easiest way is to make 2 sprites: one for the knife and one for the rope. 

Then let the rope sprite increase in the x-pos the further the knife gets from the character. Mean while start tiling the rope sprite along the x-pos.

Support / Re: Instantiate sprite & SetSprite()
« on: February 19, 2014, 08:19:34 am »
Okay, NVM... Silly me (once again). I should make the myObject public and drop the original sprite there. Instantiating the new ones will automatically get the myObject from the instantiated sprite  :-[

Support / Instantiate sprite & SetSprite()
« on: February 19, 2014, 08:14:10 am »
I have a problem with the game menu I'm creating.

To create a menu, I instantiate the menu sprites to the screen from the main game loop. Attached to each sprite I have the following code.

Code: [Select]
using UnityEngine;
using System.Collections;

public class OptionMenu : MonoBehaviour
public tk2dCamera myCamera;
static private tk2dSprite myObject;
byte MyMenuOption;

// Use this for initialization
void Start ()
Vector3 StartPos;

if(StartPos.x==myCamera.nativeResolutionWidth/2 && StartPos.y==myCamera.nativeResolutionHeight-50)
// TetraGems logo
else if(StartPos.x==myCamera.nativeResolutionWidth/2 && StartPos.y==100)
// Start button
else if(StartPos.x==myCamera.nativeResolutionWidth-75 && StartPos.y==0)
// Exit button
else if(StartPos.x==125 && StartPos.y==myCamera.nativeResolutionHeight/2+100)
// Next Blocks button
else if(StartPos.x==125 && StartPos.y==myCamera.nativeResolutionHeight/2-50)
// Next Gems button
else if(StartPos.x==myCamera.nativeResolutionWidth-125 && StartPos.y==myCamera.nativeResolutionHeight/2+100)
// Music button
else if(StartPos.x==myCamera.nativeResolutionWidth-125 && StartPos.y==myCamera.nativeResolutionHeight/2-50)
// Sound Effects button
else if(StartPos.x==75 && StartPos.y==0)
// Credits button

myObject.scale=new Vector3(1.5f,1.5f,1.5f);
else if (MyMenuOption==2)
myObject.scale=new Vector3(2f,2f,2f);

// Update is called once per frame
void Update ()
if(MyMenuOption>0 && MainGame.GameState>=20)
// Game no longer in menu mode - destroy object

void OnMouseDown()
case 2: // Play
case 3: // Exit
case 4: // Next Blocks
case 5: // Next Gems
case 6: // Music
case 7: // Sound Effects
case 8:

Each menu option ends up on their appropriate location. But when I click for MyMenuOption 4 trough 7, the sprite for MyMenuOption 8 (not yet coded :p) changes.

How can I let each sprite change their own instead of the last one I instantiated?

Support / Re: Chance camera background color
« on: February 16, 2014, 03:03:17 pm »
Just shoot me... Tried this before and it was not working and now it is ...or I must have made a typo somewhere :-\  ANyway, it's working now and BIG THANKS for the help AND patience  :-*

Support / Shades on fonts
« on: February 16, 2014, 01:32:24 pm »
I'm trying to make my own fonts and I have downloaded BMFont for that. After having had a couple of issues to get it to export in the right format, I'm getting there. But the one thing I can't get done is that extra shade you have on the (demo) GradientFont. How to add a shade to my own fonts?


nvm... found it. BMFont has an option for 'Outline thickness' at the bottom of the Font Settings  :-[

Support / Re: Chance camera background color
« on: February 16, 2014, 01:02:46 pm »
Okay, that's clear. But how do I change the background color of the tk2dCamera that I'm using? In your tutorials you state clearly that you need to remove the default (3D) camera and use the tk2dCamera instead. And with that one not having a backgroundColor property I'm wondering how to set it.

I did use camera.BackgroundColor=Color.blue, and the camera (when I added it) did change to blue, but as said above, it's not showing up on the tk2dCamera.

Support / Re: Chance camera background color
« on: February 16, 2014, 07:20:50 am »
camera.backgroundColor = Color.blue; Works, but only on the normal camera. The tk2dCamera doesn't allow this to be used. Did you remove the tk2dCamera on your latest release?

Support / Re: Chance camera background color
« on: February 15, 2014, 05:25:57 pm »
Tried that one already and I get "Assets/Scripts/MainGame.cs(168,40): error CS1955: The member `UnityEngine.Camera.backgroundColor' cannot be used as method or delegate" when I use camera.backgroundColor(Color.blue).

When I use myCamera.backgroundColor(Color.blue) (derived from tk2dCamera) I get "Assets/Scripts/MainGame.cs(168,42): error CS1061: Type `tk2dCamera' does not contain a definition for `backgroundColor' and no extension method `backgroundColor' of type `tk2dCamera' could be found (are you missing a using directive or an assembly reference?)".

Support / Chance camera background color
« on: February 13, 2014, 08:08:46 am »
I'm trying to figure out how to change the camera background color. As far as I can see, there's only an to GET the background settings and not SET it. Is this correct? If not, how can I SET the camera background color?

Pages: [1] 2 3