Mathew Mintalm

Ranch Hand
+ Follow
since Feb 21, 2010
Mathew likes ...
Netbeans IDE Eclipse IDE Firefox Browser
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Mathew Mintalm

Hello, I have android java game, where I have to deal with many different types of objects and their coordinates (player needs to place object in destination X/Y) But to make it less annoying for player I wanted to let him place object in any possible position (if there is more than one object of same type) I made this logic test code to sort objects by type, and than "send" all possible coordinates to each object:

My question is, I am not sure if its done right, and maybe there is anything I can do it better? Thank you.
10 years ago
Hello, I'm trying to change properties of my AlertDialog inside of my game, currently I'm building it with this way:

And if player clicked certain button, I'm showing this dialog with this way:

Everything works, but I decided to change look of font used in this dialog, with this way:

But code works only, if I put this code after showDialog(DIALOG_INFO); which means I have to create new object (TextView textView = ...) everytime I'm showing dialog, and my question is, can't I do it only once while creating dialog?

Thanks in advance.
12 years ago
Thanks for good words, glad you like it, yes I do own it, its my and my cooperate mate work.
12 years ago
Thanks for reply, yes I know, I won't see any difference, because of really small amount of those checks, but its always better to use better ways, especially while practising, thats why I asked.
12 years ago
Hello everyone, I'm making an Android Game

I'm still really young programmer, without big experience, so I would like to ask couple of questions (not related to making game, just some Java questions)

Game run's smooth, but I think still there are ways to improve performance (I think its always good to improve code if possible)

I decided to improve code responsible for handling events after collisions/contact between objects.

a) every game object has its ID, like for example "Wall", "Monster", "Coin" so I can know which action should be handled after contact

I have "contact listener" which is checking ID of the two object's which collided, and handling objects, more or less it looks like this (plenty of if checks)

1. So I'm comparing STRING objects, so I thought that comparing int should be faster (or I'm wrong?)

2. Second question, in android development, I'm forced to avoid creating new objects, so I should create all objects at game start up, to avoid garbage collecting which may cause slow downs, and I'm wondering if in previous code, its better to use x1.getBody().getUserData() method tree times (Which returns ID) or create temporary

String s = x1.getBody().getUserData();

and use this s object in those checks ?

3. Last question, since I will switch from using STRING to INT in game objects id, i thought that I should use switch statement, instead of multiple if's. I have been reading that it should be faster.

Thanks for answer.

12 years ago
Thanks for reply, so here's code to encrypt:

and decrypt

but still I can't make decrypt method to work properly.

About your previous reply, I did it in one method, because I thought its depends on key, if is >0 its encryption and while <0 decryption.
12 years ago
Hello I have been forced by my maths teacher to create website for competition about promoting mathematics.

I chose mathematics in IT/programming. I'm presenting some of my own experience, especially in android game development.

But I wanted to include something easier as well, and created section about cryptology, and wanted to create Java applet with Cezar cipher

And I have problem, encryption works as it should, but decryption doesn't.

Thats how I understand it:

(sorry for polish description in gif above)

1. type the alphabet

2. Move every character in right direction (based on key, in this case its 3)

3. Put last 3 chars at begining.


I'm using those formulas to encrypt/decrypt

n - number of latter we want to encrypt/decrypt

k - number of movement (in our case 3)

x - number of chars in our alphabet (26 in our case)


So I created following code, but as I mentioned it seems to work only in one way (encrypt for example key 3, but decryption gives wrong values for example for key -3)

I will be glad if someone might help me correct it, thanks!
12 years ago
Thank you for answer.
12 years ago
Hello, I have HashMap<Integer, Integer>, with 100 numbers inside (1-100 range) where this number is key, and every has its default value which is 0.

Now I'm wondering how can I get for example object from this map, lets say with key 1 and ++ its value? So it would change from 0 to 1 in this case.

12 years ago
Yes, you were right, now it works as it should, thanks everyone for help.
12 years ago
What about StringTokenizer class?
12 years ago
Thanks for replys.

But the point is that I'm receiving wrong values (I mean different than those provided by my teacher)

My previous lesson was about "encryption", and after every lesson he is giving me different task, like write program in my language (which is going to be used during my school secondary school certificate - IT)

For example for 'A' im receiving 65, and my teacher said its $41 (this dollar doesn't really matter, I need just number for calculations)
12 years ago
I have to receive those numbers, for example there is String s = "test";

I will split this string into chars and I need to receive this number for every char.

By saying number i mean, for example:

A is $41

Thank you
12 years ago
Hello, I'm wondering how can I receive "code" of the given char (keyboard code)

For example its:

$41 - A
$42 - B

$30 - 0
$31 - 1

and so on.

Thanks in advance for help.
12 years ago
Thanks for answer.

I can get attribues like this:

but I can not iterate.

//edit, I found this way to iterate over this map:

It works, but do you think it will be ok like this?