chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] Chicken and Cocos2Dx on Google Play!


From: Kristian Lein-Mathisen
Subject: [Chicken-users] Chicken and Cocos2Dx on Google Play!
Date: Fri, 2 Nov 2012 15:20:28 +0100


Dear Chickeners,


I have been playing around with Chicken, Chipmunk and Cocos2Dx for a while, and I've finally got a demo up and running on Android. I've published it on Google Play in the "Libraries and Demos" category so you guys can test it!

Check it out: Scheme REPL with Cocos2Dx

The demo features a truck which you can drive back and forth, clumb up hills and fall down. Not very exciting, but I do actually catch myself playing it when I don't know what I should be coding on! The cool part is that there's a Chicken REPL behind the scenes.  You can connect to the REPL directly from your laptop if your phone is on the same WiFi, or use USB. Try Settings->Wireless Networks->Wifi Settings-> [Menu]->Advanced when looking for you phone's IP.

With netcat (or Emacs, with nc [ip] [port] as your Scheme interpreter), you could try:

$ nc [phone ip] [port]
Alternatively, you could use USB with adb and forward:
$ adb forward tcp:1234 tcp:1234
$ nc localhost 1234
Once you see the REPL prompt @>, you can play around:

;; 'import' chipmunk bindings
(use chickmunk)
;; where is the player?
(body-get-pos truck)

;; redefine game-loop to pause game unless you're touching the screen
(define (*update*)
  (if *touch-down* (space-step space (/ 1 120))))
;; now let's give the truck a gentle push
(body-set-ang-vel wf -20)
;; now touch the screen to watch it drift off
;; restart the app to revert your changes
(exit)

;; You can also manipulate the physics-world:
;; Drop a ball from the sky
(space-add space
  `(body ((pos (320 700)))
    (circle (density 0.001)
    (friction 1)
    (radius 10))))
;; Add a gentle but slippery slope
(space-add space
  `(body ((static 1))
    (segment (friction 0.1)
    (endpoints ((250 500)
    (800 550))))))

;; type this to see the touch-down state:
*touch-down*
;; it should be #f when your finger is off the screen, and touch-coordinates otherwise. evaluate it while holding the screen to try it out!


If you have an Android phone, it'd appreciate if you took the time to check it out. I am particularly interested if the app won't start at all, and perhaps what framerate you're getting (very bottom-left). I know there is a memory leak somewhere (thanks Alaric!), but otherwise I hope things should be running fairly smoothly.

Cheers!
Kris

reply via email to

[Prev in Thread] Current Thread [Next in Thread]