Pygame Trail Leaving - image

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.

Related

Joint for physical gun slider?

I want to make it so when I fire my gun the slider shoots back and then comes forward like a real gun. However I don't know how I should start because I can't find any relevant information on Google and I don't know what to search. All I need is the logic behind how to do it, I can code it myself.
I would agree with zambari.
Just create an animation and play it when your guns gets fired.
Edit:
Since you are talking about 3D, you could either
move the pivot of the object to the point where the trigger would be attached. This way, all you need to do is change the objects rotation for the animation.
use joints
This is the best tool for VR guns with interactable parts. I HIGHLY recommend looking at this to ANYONE making a VR game
https://github.com/Oyshoboy/weaponReloadVR

Detecting When A Moving Shape Is Clicked (For A Game)

I'm a CS scrub and I thought I understood everything until now. I'm being prompted to make anything I want, so I'm choosing to make a little game I've been thinking about for a few months. The problem is that I don't know where to start. We've been using JavaFX and we've done some animation but I don't fully understand everything. I don't really understand mouse events but the idea I have depends on them. Anyway, here's the idea:
The main (2D) game is about reducing fractions.
Imagine the window being split horizontally into top and bottom.
Now, imagine boxes spawning out of view and moving into view toward the horizontal center line. The boxes will only be moving vertically and each box has a random integer. When a box gets to the center, it'll stay there and allow for other boxes to land on top of it (or below it if it came from the bottom).
Boxes are eliminated by "reducing" a number in the numerator with a number in the denominator. Several boxes may be selected on one side before reducing them with the other side. Here's a picture that might help convey what I want to do:
Crude Three Frames of the Gameplay Drawn In Paint
Hopefully that all makes sense.
I've been trying to use an extension of Rectangle but I don't really know what else to do. I figure I'll need to create some ArrayLists to keep track of the boxes and some other lists to keep track of factors as well. Anyway, any help would be fantastic. Thank you guys very much!

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.

Auto rotate the bottom of the house to the line

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!

Resources