This site requires JavaScript, please enable it in your browser!
Greenfoot back
Pointifix
Pointifix wrote ...

2014/3/14

Mouse Buttons

1
2
3
4
danpost danpost

2014/3/14

#
Bummer. There still may be problems. I did not know you would be using the mouse information so extensively (at first!).
Pointifix Pointifix

2014/3/14

#
you tried the code? or why you saw im using it that extensively?
danpost danpost

2014/3/14

#
I moved your middle 'if' block (that started 'if (mouse != null)' up into the previous 'if' block so that the image is only updated when right-clicked on.
item_rotation = (item_rotation+1)%4;
//    is equivalent to
item_rotation++;
if (item_rotation == 4) item_rotation = 0;
Pointifix Pointifix

2014/3/14

#
jeah i know that, mhhmm, but now all runs well as i tested!
danpost danpost

2014/3/14

#
Having fields to hold information that often changes and that you can acquire the values of by calling a method or two is not wise programming (unless you are very familiar with programming and are able to track those fields flawlessly). Keeping up with the changes can become difficult and becomes a problem when they contain mis-information. Fields line 'x_mouse_pos', 'y_mouse_pos' and 'mouse' would better off be omitted. The current values can be acquired when a mouse event occurs (such as 'mouseMoved', 'mouseDragged', 'mouseClicked', etc.)
Pointifix Pointifix

2014/3/14

#
you mean they should only be updated if the raster is beeing dragged?
danpost danpost

2014/3/14

#
No. Only when right-clicked on.
danpost danpost

2014/3/14

#
Maybe I misunderstood what you meant by your last post. I will try to answer again (a different way -- as if you meant something else).
Pointifix Pointifix

2014/3/14

#
on the left top corner i always show the pos in the raster the mouse is so it should be updated each act
danpost danpost

2014/3/14

#
Pointifix wrote...
on the left top corner i always show the pos in the raster the mouse is so it should be updated each act
I see you were more on course than I realized. I will look through it again and see what I find.
Pointifix Pointifix

2014/3/14

#
k would be really nice
danpost danpost

2014/3/15

#
Still trying to see how I would do it so I could better help you out.
danpost danpost

2014/3/15

#
What is the purpose of line 110 in your World subclass? The line is in your 'ItemAtMouse' method as is as follows:
if(item_actual != 0)image_atmouse = ChangeImageColor(image_atmouse,new Color(item_colorarray[item_color].getRed(),item_colorarray[item_color].getGreen(),item_colorarray[item_color].getBlue(),155));
It looks like this 'highlight's or lightens the image by making it somewhat translucent. Is this just for when the mouse is over that particular item? If so, again, drawing image with lesser alpha values on images with full (255) alpha values does not change the alpha value of the resultant image. The image will stay opaque at full alpha value of 255. Also, it would be best to keep the background image of the world opaque. You will end up with some strange behaviors if it is not kept totally opaque. It is your backdrop and you should not be able to see through it at all. Got another question: are you trying to do this without any Actor objects on purpose? or have you just felt no need for any?
Pointifix Pointifix

2014/3/15

#
This line lightens the actual object at the mouse up, if clicked, the field on this place will be set to the actual item/rotation/color. I just did the Editor, to get worlds, later on i will add objects living in that world and interact with all these objects (like the quater pipe, the rectangle, the slab and so on), so like a good platformer i think
Pointifix Pointifix

2014/3/15

#
i oriented this on a game called 'The N-Game' or 'The Way of the Ninja': http://www.thewayoftheninja.org/n_downloads.html
There are more replies on the next page.
1
2
3
4