Auto rotate the bottom of the house to the line - algorithm

I just wanna ask you way to do this.
How can auto rotate the house object to the line which is bottom align to the line, when the user moves the house to the line. (see example)
I know black dot and house's coordinates.

I implemented this, following coproc's advice. Unluckily, the code is a little to lengthy to post here, but you can read it and check it working online in wonderfl:
http://wonderfl.net/c/rYYU
Most relevant code lines are commented, the only assumption is that the house's graphic registration point is at its center (in my case I drew a Sprite, but it should work just as well with any MovieClip). I think it accomplishes quite well what you are looking for.
Hope this helps!

Related

Pygame Trail Leaving

Alright so, i'm currently working on a big pygame project. I'm actually working on building a tank game, based on space invaders. The issue is(i mean it's not necessary, but whatever) that whenever my tank moves left or right, i want him to leave a certain trail. Now, the trail is an image of an actual tank trail, and i'd like to keep displaying that image after he moves left, right, down or up, exactly like he's leaving a trail;. The point is that i want my game to look very cool, and i think this is a big extra to that. I won't post my code since i just need general instructions on this topic, not a specific code clarification or something else.
Thank you all in advance, you're awesome! :D
P.S. Here's a trail image! I'm srr it's a link tho :(
https://i.stack.imgur.com/177IS.png
You would have to create an image for the tread marks and then load it using transparency/alpha. Then as you drive you would need to add those to a list with positions trailing the tank as it drove. You would need to keep the entire list of the trail and keep drawing it onto the background as you redraw the screen.
One thing to keep in mind is that if the tank drives back over them, you will not want them visible over the tank, so you will need to layers or just make sure that the tank is drawn last.

A photo to vector 'scribbled line' algorithm

I would like to build an algorithm that turns a picture into a scribble line that resembles the original picture.
An example would be this:
into this:
The second image is drawn by hand with one stroke.
I am not sure where to begin experiments. My intuition would be to desaturate the image and simulate "drawing" a line with some quasi-randomness that draw more lines in places where the image is darker.
Ideally what I would like to get is a vector image in the end with one path.
Thank you
Disclaimer: I have already asked this question on dsp.stackexchange 3, but there was no answer. I am not sure if that was the right place to ask.
I realise this is not purely programming question, but maybe someone can point me in the right direction?
Try this ... not mine, but pretty neat.
The 'files' tab of the code page contains the original image file.
Processing is a fun language for doing this kind of stuff :-)
https://www.openprocessing.org/sketch/486307
Interesting option (less arty than your example =^) :
http://cgv.cs.nthu.edu.tw/projects/Recreational_Graphics/CircularScribbleArtsPoster
https://cgv.cs.nthu.edu.tw/publications

Dragging a globe in D3

By far the most elegant way to rotate a globe in d3 that I've seen is Jason Davies' version: https://www.jasondavies.com/maps/rotate/
Unfortunately his code is minified, and even if I un-minify it, I can't make heads or tails of it with all the variables and functions named with single letters. (It doesn't help that the page includes code to implement "naive" rotation, and also the zooming, which I don't need.)
Anybody know of a demonstration of this technique that doesn't obfuscate the code?
Try looking here: http://bl.ocks.org/KoGor/5994804. The only thing is that you need to start dragging on a land and not on a water.
You may disregard text in Russian (the code has comments in English), but you may also consider translating it and the linked article.

how to use texture masks in game Maker?

First off I'm not totally sure if "texture masks" is the correct term to use here so If someone knows what it is then please let me know.
so the real question. I want to have an object in GameMaker: Studio which as it moves around it's texture changes depending on its position by pulling from a larger static image behind it. I've made a quick gif of what it might look like.
It can be found here
Another image that might help explain this is the "source-in" section of this image.
This is a reply to the same question posted on the steam GML forum by MrDave:
The feature you are looking for is draw_set_blend_mode(bm_subtract)
Basically you will have to draw everything onto a surface and then using the code above you switch the draw mode to bm_subtract. What this will do is rather than drawing images to the screen it will remove them. So you now draw blocks over the background and this will remove that area. Then you can draw everything you just put on the surface onto the screen.
(Remember to reset the draw mode and the surface target after. )
Its hard to get your head around the first time, but actually it isn’t all that complex once you get used to it.

Kinect+Processing: detect where user arm+hand is pointing?

I have an idea for a project but, as I've never used the kinect before I want to know if it can be done with it. What I want to do is to find out where a user is pointing to (in 3d space). Then ok, I want to detect the skeleton of his arm (and I saw this can be done) and then virtually 'extend' it (drawing a line for example) to check where is pointing in the space. Basically I will have a wall and I want to find out where (which area) the user arm is pointing on that wall (and the user won't be touching the wall, of course).
If you know any interesting source I'd really appreciate it.
sorry for my english.
thanks
Getting the arm's skeleton and projecting won't help you: there is no way of telling where the Kinect is relative to the screen, so you won't know to what point in the screen the user is pointing. You could achieve something like that using calibration: ask the user to point to the center of the screen, save that coordinate, and then do all the calculations relative to that one.

Resources