Slap the zombie

You all possible know this app and how it work using camera to slap zombies.

I want to make 1 game prototype using almost same controls scheme.

Do you think is it possible in Codea, any tips or guidelines?

Thanks in advance :slight_smile:

I cannot seem to find Slap Zombies on my App Store, could you describe the controls and the games goal?

It actually called “slap that zombie”

I have no idea how to do it but ill give it a try. What I’m thinking is this make a sprite showing the camera. Then for the pixels within the sprite, insert the pixels colour into a table(i am not even sure if this is possible) then check if the colour has changed. If the colour changed(to something similar to the colour of your hand) then do something.
But I have two questions

  1. does the ipad have a proximity sensor.
    2)And if it does, have you played the game to see that it uses the camera and not the proximity sensor. I saw the description of the game on the AppStore it says it uses the camera but I am not sure if that’s right.
    I would love to try the game myself cause it looks something different from the kind of games I’ve been playing.

The way I would do this is to take a picture using the camera and compare it with your baseline picture (one without hands waving). I would test a sample of pixels across the image to see if more than X have changed. The real problem, I think, is figuring out what the hand is doing, and which direction it is moving in.

The demo camera app is where I would start, though.

This kind of functionality, where the computer recognises an item and translates it onto the app, is very hard to make from scratch. I cannot think of any possible solutions of how to solve this, due to that I dont know how images works, but also it will be very hard to create a similar sensor.
If you stop the project because of non succeeding progress then you could try doing it with some touch instead, that will work better but be less cool, so to speak.

I hope you all your luck on getting this to work!

I agree with @Ignatz, if it was me I’d start by creating a block of small (128x128?) image and getting the source from the camera in rotation so that each frame I’d have the last x number of frames to work with.

Then I’d try and come up with some kind of image post process so that you can do some kind of edge detection / anything that will reduce the image to as few colours as possible.

Not sure if a shader could be used here to generate the filtered camera data offscreen, but it might be possible.

You need to compare the filtered image against the last one so you could identify a “major” change which would indicate some kind of motion which ultimately you use to register a “hit” in the game.

Have you thought about looking through the OpenCV libraries to see how / if they manage motion detection in an image? The thing is it might be heavy on the maths and possibly beyond the scope of what you can realistically do in Lua

As as last resort you could try getting in touch with the original author of the game and asking him for some pointers - it might be worth a try :slight_smile:

The camera source in Codea is the way to go, but doing it in lua I think the performance would be insufficient… There may be some kind of hacky shader solution to the problem

I would work to Codea’s strengths, and use touch instead.

Way easier, and just as fun to play.

I was thinking to do prototype, kind of kill mosquito on ipad ! :slight_smile:

I 110% support what @Ignatz said - always play to the strengths of the machine (AND environment) your working on / with. Great advice!

Out of interest, I played with motion detection, and it is feasible, but it is likely to hammer the frame speed, and hand movements are messy (not least because there is an arm attached to the hand) and it can be difficult to detect direction reliably.

Essentially I’m saying it’s hard, and there are easier options that will be just as much fun to play.