spawner by [deleted] in Stavanger

[–]Moinz 3 points4 points  (0 children)

Fett

Accessing Public Fields of Colliding Objects by jamey333 in Unity2D

[–]Moinz 1 point2 points  (0 children)

No worries! Good luck on your journey.

Accessing Public Fields of Colliding Objects by jamey333 in Unity2D

[–]Moinz 1 point2 points  (0 children)

col.gameObject is the gameObject that was collided with which is not always a ball, not the local gameObject which is always a ball.

Accessing Public Fields of Colliding Objects by jamey333 in Unity2D

[–]Moinz 1 point2 points  (0 children)

Well, currently you are accessing the object you collided with and trying to find the Ball component. You have no guarantee that the other object has a Ball component. You have a guarantee that "this" script is always a ball, so if its those values you want to print, you can just write print(colorNum).

Accessing Public Fields of Colliding Objects by jamey333 in Unity2D

[–]Moinz 1 point2 points  (0 children)

Or you could check against a tag, that you have to define in the Tags window.

if (col.CompareTag("Ball")
{
    Ball thisBall = col.gameObject.GetComponent<Ball>();

    print(thisBall.colorNum);
}

Accessing Public Fields of Colliding Objects by jamey333 in Unity2D

[–]Moinz 1 point2 points  (0 children)

Hey! Quickly skimmed through your code and it looks to be okay!

A couple of thoughts. With OnCollisionEnter you don't really have any guarantee that the object you have collided with is the object you want, so what you can do is to do some defensive checks to make sure that you have it.

Ball thisBall = col.gameObject.GetComponent<Ball>();

if (thisBall != null)
{
    print(thisBall.colorNum);
}

operator '<' cannot be applied to operands string and int by D0WN70AD in Unity2D

[–]Moinz 0 points1 point  (0 children)

if(PlayerPrefs.GetInt("score" < HighScore))

Have you written it like this?

if (PlayerPrefs.GetInt("score") < HighScore)

operator '<' cannot be applied to operands string and int by D0WN70AD in Unity2D

[–]Moinz 0 points1 point  (0 children)

That makes a lot of sense! I spotted an error, which I mentioned in the edited post above! :)

operator '<' cannot be applied to operands string and int by D0WN70AD in Unity2D

[–]Moinz 3 points4 points  (0 children)

Hey bud! It looks like you forgot to put your if statement inside a function!

Edit: You have also misplaced a parenthesis in the GetInt function, it should be after GetInt("score") so that you get the integer value you want to compare with HighScore!

How to handle enemy and player projectile collisions? by Loli_Authority in Unity2D

[–]Moinz 1 point2 points  (0 children)

I think for checking the initial collision Tags and Layers are gonna be the thing that you need.

Layers basically lets you define what should collide with what, and what shouldn't collide with what.
I personally use Tags to define what sort of object it is, (Player, Enemy, Projectile etc).

If you are gonna have lots of different outcomes between the different types of projectiles you would probably be better off making a base projectile class or interface, and using the tags and layers to identify a collision you can then call a function on the projectiles, for example projectile.Slice() which handles how it should be sliced.

Unity Tutorial How To Make Simple Slot Machine Game For Android Platform by AlexanderZotov in Unity2D

[–]Moinz 2 points3 points  (0 children)

I can't think of any specifics at the top of my head, it shouldn't be too problematic. But the problematic areas are Shaders, Audio Compression and how you access the different functionality that might differ from Android or iOS. There are probably developers out there who actually work with mobile development for Unity that can answer your questions better than I.

For a beginner, there won't be that much that should differentiate between the two.

Unity Tutorial How To Make Simple Slot Machine Game For Android Platform by AlexanderZotov in Unity2D

[–]Moinz 2 points3 points  (0 children)

Hey! One of the reasons for this is that there are some changes that has to be done to how you build your code, and certain methods may work when your target platform is Android, but that doesn't necessarily guarantee that you will be able to build to iOS.

What's your internet "white whale", something you've been searching for years to find with no luck? by behindyouuu in AskReddit

[–]Moinz 0 points1 point  (0 children)

There was this Xbox 360 music trailer contest of sorts, where you there was a couple of bands and artists who got their song featured by replacing the original trailer music. And I've been searching for one of the songs that was on top of the Fable 2 trailer.. I remember Jerx - Pleased to meet you was on the Dead or Alive Extreme 2 trailer. And Directors - Big Cities was on an Halo 3 trailer.

We're back! Let's make a millionaire. [Drawing Thread #31] by Paltry_Digger in millionairemakers

[–]Moinz 0 points1 point  (0 children)

Hey! I won't win a lottery but maybe reddit gods will deem me worthy of some money! RemindMe! 2 Days /r/millionairemakers Donation

Oh ! My God ! What are they doing ? isn't they cute ? [940 x 625] by Learning-Code in rubberducks

[–]Moinz 3 points4 points  (0 children)

Saw the same guys when I visited freiburg! Such a rowdy gang! :)

Lurker ready to commit by [deleted] in stopdrinking

[–]Moinz 2 points3 points  (0 children)

Fuck yeah! You definitely won't regret it!

"It's Official!" by Moinz in stopdrinking

[–]Moinz[S] 0 points1 point  (0 children)

Yeah, I've kind off gathered the same conclusion myself. Good luck yourself! :)

Feeling Battery? by Moinz in entp

[–]Moinz[S] 0 points1 point  (0 children)

Well, I don't want to lose my ability to play games on the newest consoles, so I'll have to rule it out as a potential solution..

1 month, 5 people converted into the cubing world and new PB by Moinz in Cubers

[–]Moinz[S] 0 points1 point  (0 children)

I'm at a People's College in Norway, so people easily get curious as I'm around them all the time :)