How do I make my pieces move and implement the jump mechanic in American checkers using Make Code Arcade? - 2d

I'm fairly new to coding, and I wanted to create an American checkers game in Maker Code Arcade.
I started of by creating an 8x8 tile map using the Tile map extension and creating a movable sprite which would serve to select which ever piece I would like to move.
I then created two functions called player1 and player2, both having an image parameter, that would set my sprites image based on the imported image when the functions gets called.
I then created a function called layout, which would layout my pieces where they belonged. It would do this by calling my player1 and player2 functions and placing them on which ever tile I specified them to be.
This would be my end result.
But now I have no clue how to move the pieces, how to implement a jump mechanic, or how to create kings.

Related

Selecting non-contiguous regions in Godot tilemap editor for atlas creation

I'm trying to create an atlas of collideable objects in Godot's tilemap editor. My understanding is that, to select a region of tiles to make part of the atlas, you have to mouse select (I tried clicking a cell and holding Shift but it doesn't select multiple cells). The issue is that I can't seem select a non-square region.
I also tried selecting cells one at a time, adding the collision area, and then picking a new cell, and what I end up seeing is my range of cells shift over to the new area. Do I need to re-create my tilemap source to just have contiguous regions, or is there some Godot functionality I'm missing here? FWIW, I was following this tutorial to get up and running.
The region has to be a rectangle. You may want to break it up into multiple atlases plus a New Single Tile for the one at the top by itself.
Single Tile
Atlas 8x1
Atlas 2x1
Atlas 2x1
When you go to paint, selecting any of the atlases will show you the tiles inside.

Working with google maps api

I am trying to build a map based query interface for my website and I am having difficulty finding a starting point besides http://developer.google.com. I assume this is a rather simple task but I feel as though I am on a wild goose chase. Anyway the problem is the existing site places people into a category based on their address (primarily the zip code), this is not working out because of odd shapes and user density so I would like to solve the problem by creating custom zones.
I am not looking for a proprietary solution because I would really like to accomplish this on my own, I just need some better places to start or better suggestions for searches.
I understand that I will need to create a map with my predetermined polygons.
I understand how to create a map with polygons via js.
I do not understand how data will request which zone it is within and how it will return it as a hash I can store. eg. user=>####, zone=>####, section=>#####
http://blog.appdelegateinc.com./point-in-polygon-checking-with-google-maps.html
has some JS you can add to give the ability to test whether a point is within a polygon (sample: http://blog.appdelegateinc.com./static/samples/point_in_polygon.html ) using this approach: http://en.wikipedia.org/wiki/Point_in_polygon#Ray_casting_algorithm
I think as you place the markers, you'll hold them in an array (of objects)...then loop through, doing some sort of reduction of which polygons to test, testing those that remain, if inPoly, set marker.zone and marker.section to whatever suits your needs

Jumping back into XNA T

I just got back into XNA and i started creating a map editor. The game will be a 2D editor that will contain both a Animation, Map, Level, entity, and crafting editor. So far it's going pretty swell right now; but, I think i am missing some key things within the editor
Here let me explain the game I'm trying to make:
I really want to figure out how to craft a particle editor
I also want to know how to use farseer phsyics engine (tried getting started on XNATutorial.com, but it's not working correctly).
Thank you in advance for any help you can give me, I'm just trying to see what would be the best things to enter into the game for a 2D action platformer.
To craft a particle editor decide on what you want to be able to do first, then come back with more specific problems, or questions.
Maybe you want to be able to design a particle template. This could define a particle's appearence and behavour.
Then you'd edit a particle emitter template. This would define what particle template to spawn, and what initial properties a particle instance would have.
Then you'd create a particle emitter object in your editor. You could maybe override specific properties in the particle emitter templates.
You could event have a particle emitter template that was a list of particle emitters to spawn, so you could emit different particles from a single editor object.
This would allow you to create lets say a fire-outside particle template, which was a yellow circle, a fire-inside particle template which was a red partcile, with a shorter life than for former. You'd then define 2 particle emitters, one for each one. Giving spawned particles upwards, but slightly random directions. Then create a multi-emitter called Fire or something. Then in the level editor you'd just have to place your Fire emitter and in-game you'd get a nice fire effect.
Posting a specific problem you have with setting up the physics engine would help.
The overall idea is that you have your game object representation, and you need to create and link them to the physics objects so you can simulate those objects and then update your game objects (for rendering and game logic).
So, when you load your level you'd loop through every physical object and create an equivalent in your physics engine, being sure you can link your game object to the physical one later. Obviously you'd need to keep both systems in sync by adding/removing physical objects as the game progressed and game objects where created/destroyed.
Then in your game loop you'd run your game logic, which might update their positions directly. Then update the physics objects so their position was the equivalent to the game object's. Then run a physics update. Then update your game object's positions according to the physical object's positions.

Display opencv frames in a window with button and text control

I'd like to ask you some information about a problem which i want to solve.
At the moment, I have two opencv applications:
application A: where i track an object with two types of algorithms and each time i save a frame in an image file and i control the application behavior with some commands which i write in the shell
application B: where i have a loop which reads every time the image file and display it
So, I launch these two applications together in order to track the object with appA and to display results with appB which reads everytime the frames saved by appA in the hard disk.
I want to integrate application B in application A in order to show a window (like this: http://lnx.mangaitalia.net/window.jpg) in order to have a loop which shows image in the first area and to use buttons in order to give commands which at the moment i write in the shell.
Do you think it's possible to display the frames in an area with Qt or opengl or wxwidgets?
Which solution is the better and the easier to apply?
At the moment, my application B is very simple:
while(1)
{
Mat img=imread("result.jpg",1);
if(!img.empty())
imshow("HOG",img);
if(waitKey(200)==27) break;
}
I want to show these frames in a window which has also some buttons.
In particular, as you can see in the attached image in this post, i want to create a window divided in two parts: the first one which display the frames captured from opencv camera and the second part (or area) which has some buttons (B1, B2, B3..) which the user can press in order to control the application behavior.
(At the moment, i use a switch/case in appA to trap the keyboard keys)
There is some example based on a template similar to what i'd like to do?
(like the jpg image i've told before: http://lnx.mangaitalia.net/window.jpg)
I propose that you just use the inbuilt GUI in OpenCV: highgui. It has keyboard/mouse IO, window control with a message loop, buttons, sliders etc. And there is no need to do any conversions of the cv images to show them.
Have a look at: http://dasl.mem.drexel.edu/~noahKuntz/openCVTut3.html (It is written for old IplImage style CV, but the C++ interface is almost the same, use cv::imshow to draw images)
Also, here is the documentation for the C++ style interface.
There is also the possibility to convert your CV images to QImage in Qt and do it that way... you should be able to find solutions for that on Google.
There are some examples out there for implimenting this.
see http://larryo.org/work/information/wxopencv/index.html
Basically what you want to do is:
capture a frame from your camera
manipulate the image
use cvConvertImage to convert it into a format wxImage can read
draw this image on to a wxCanvas
For the GUI part of this, you would need to create a wxFrame or wxWindow, place some sizers and buttons at appropriate places.
So basically make a frame, put a sizer on the frame, then put a panel in the sizer.
next make a vertical sizer on the panel. First add a wxCanvas to the vertical sizer, then place a horizontal sizer in the vertical sizer. Now add 3 buttons to the horizontal sizer, and you have your panel.

Adding one point to a flex line series without everything getting redrawn

I have an air app that collects live data from a user's action and graphs it. It records data every second and charts it on three different line series from the same array collection.
This works out great at first, but it gets worse and worse as time goes by. When it gets close to an hour it's almost unusable.
I'd like to be able to add a point to the graph and have flex JUST draw the new point and not invalidate the whole series and redraw it. Is this possible? I'm willing to override something to make this work.
My last ditch effort is to take the average of 5 or 10 points and only adding those. This will still work poorly when the user is going for 3 hours or so, but I can't think of a better way.
First, I wouldn't use ArrayCollection, but ArrayList since it's faster than ArrayCollection. Even better would to use VectorCollection.
Second, the Flex charts are made to be easy to use, but not very good at going 'outside the specs'. What you'll need to do is override the core functionality of the chart altogether for this to work, however that is a fairly daunting task because of the sheer amount of code involved in charts.
I would recommend you either create your own very quick and dirty component that draws the lines (it's fairly easy, I've done it myself) or use another charting library out there like Flare.
I added a UIComponent that overlaid the whole graph. I then used a cartesiandatacanvas to convert the current data point to x/y coordinates on the screen and did a lineTo to draw from the last point.
This lets me keep drawing the graph without a total reload of the data.
Each point is inserted into a sqlite db. If the chart is resized I clear the uiComponent.graphics and query the sqlite db and bind the data to it. If the user plays the chart from there I leave the currently drawn lines on the chart and continue using the above method.

Resources