Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Ian Price

Pages: [1] 2 3 ... 10
1
Code Snippets / Snake a la Nokia
« on: 2013-May-26 »
Here is a short and simple piece code of that recreates the snake movement in the Nokia Snake mobile phone game.

The code doesn't include collision detection between the snake itself or walls (in fact there aren't any), but it does allow collisions between the snake head and the flashing food. The snake also grows as you eat.

Code: GLBasic [Select]
// --------------------------------- //
// Project: snake
// Created by: Ian Price
// Start: Sunday, May 26, 2013
// IDE Version: 10.283

GLOBAL body_x%[], body_y%[], length%=1, fruit_x%, fruit_y, speed%, dir%, score%

DIM body_x[100]
DIM body_y[100]

// Head position
body_x[0]=10
body_y[0]=10

// Tail position
body_x[1]=9
body_y[1]=10

// Create fruit at random position
fruit_x=RND(39)
fruit_y=RND(29)

WHILE TRUE

 // Set snake direction
 IF KEY(200) THEN dir=4
 IF KEY(205) THEN dir=1
 IF KEY(208) THEN dir=2
 IF KEY(203) THEN dir=3

 // Move snake in selected direction
 IF dir>0 AND speed=0

    // Eat fruit
    IF body_x[0]=fruit_x AND body_y[0]=fruit_y
     INC score
     fruit_x=RND(39)
     fruit_y=RND(29)
     INC length
    ENDIF

    // Ensure that all segments follow the head
    FOR n=length TO 1 STEP -1
     body_x[n]=body_x[n-1]
     body_y[n]=body_y[n-1]
    NEXT

    // Move head segment
    IF dir=1 THEN INC body_x[0]
    IF dir=2 THEN INC body_y[0]
    IF dir=3 THEN DEC body_x[0]
    IF dir=4 THEN DEC body_y[0]

 ENDIF

 // Draw "fruit"
 DRAWRECT fruit_x*16,fruit_y*16,16,16,RGB(RND(255),RND(255),RND(255))

 // Draw head
 DRAWRECT body_x[0]*16,body_y[0]*16,16,16,RGB(255,0,0)

 // Draw body segments
 FOR n=1 TO length
  DRAWRECT body_x[n]*16,body_y[n]*16,15,15,RGB(0,255,0)
 NEXT

 DEC speed

 IF speed<0 THEN speed=5

 PRINT "SCORE "+score,10,10

 SHOWSCREEN

WEND
 


[EDIT] Removed initial value from "speed"
[EDIT 2 by Schranz0r] Set Syntax highlighting for your post   :-[

3
Off Topic / So, OUYA. Will YA?
« on: 2013-Apr-04 »
So is anybody planning to get an OUYA at any point? Did anyone buy into the KickStarter?



I'm still on the side-lines, but if GLB supports it then I'll definitely take a punt.

It's shipping now, and early reviews are so-so, based on the early hard and software. Most criticism that I've read so far focuses on the controller and it's magnetic clip on facias.



Review here - http://www.engadget.com/2013/04/03/ouya-review-founding-backer-edition/

4
I did a search of the forum and couldn't find anything relating to this, so...

I haven't got a specific Android device yet (I can use Pandora or TouchPad, but they are not dedicated), so I need some help with the transferring of compiled Android apps. to someone that does.

If I want to send/give a file to someone with an Android device for them to install for testing etc. do I need to send them just the .glbasic-release-unsigned.apk, or is it one of the other .APK files? Does it need any media folders etc. ?

I've seen how to install an .APK - http://www.talkandroid.com/guides/beginner/install-apk-files-on-android/   is this generally how others can install my glb app. ?

This is for testing only, and not to put on any market places.

5
This topic has been moved to Bug Reports at user's request :)

http://www.glbasic.com/forum/index.php?topic=9041.0

7
Here's my entry for the Dragonbox Coding Competition 2012/2013.

It's a retro styled arcade adventure puzzler set under the ocean.



PANDORA - http://www.iprice.remakes.org/my_stuff/AquaVenture.pnd

CAANOO - http://www.iprice.remakes.org/my_stuff/caanoo_aquaventure.zip

WIZ - http://www.iprice.remakes.org/my_stuff/wiz_AquaVenture.zip

PC - http://www.iprice.remakes.org/my_stuff/pc_AquaVenture.zip





[EDIT] Added a Wiz version. There's a long pause at the start of the app - it hasn't crashed, it's unpacking the gfx/sfx.

8
Off Topic / Hamster on holiday?
« on: 2012-Dec-31 »
Is the hamster that normally runs around in the wheel that powers the GLBasic forums on holiday?

Is the forum slow for anybody else recently?

Are sooo many people online due to being off work at Christmas slowing it all down?

It's not constantly slow, but there have been times this week where it's taken a fair while to load a page.

11
Announcements / New game for Halloween
« on: 2012-Oct-31 »




[EDIT] Download is now removed and added as an attachment later in this thread.

Use the mouse to click on the masks (more than one has to be connected to similar masks) - the more connected masks disappear the more you score. Clear the board of masks to go to next level.

I couldn't think of a name at first so called it Hallowian (after me, sort-of), but I'm now thinking Halloweenie would have been better, but there ya go.  I don't plan to update it at all.

[EDIT] The game is available for Caanoo too - http://www.iprice.remakes.org/my_stuff/Hallowian.rar

12
Hi Gernot

While porting Guru Logic to the Pandora I discovered that the GETPIXEL command (in GLB v10.283) always returned zero.

The code below works fine on pc (and Pandora), however pc version correctly returns different values when moving the cursor over different colours - the Pandora always returns zero.

Code: GLBasic [Select]
SETSCREEN 800,480,0

CREATESCREEN 1,999,800,480

USESCREEN 1

FOR n=0 TO 1000
 DRAWRECT RND(800),RND(480),RND(64),RND(64),RGB(RND(255),RND(255),RND(255))
NEXT

USESCREEN -1

LOCAL mx,my,b1,b2, pixel

WHILE TRUE

MOUSESTATE mx,my,b1,b2

DRAWSPRITE 999,0,0

pixel=GETPIXEL (mx,my)

PRINT "PIXEL "+pixel,10,10

DRAWLINE mx-10,my,mx+10,my,RGB(255,255,255)
DRAWLINE mx,my-10,mx,my+10,RGB(255,255,255)

SHOWSCREEN

WEND
 

13
 As I am now the proud owner of a real working Caanoo, I've ported four of my older games (from GP2X and Wiz) as well as one new one to the Caanoo and uploaded them to the archive.

A couple of these games were available for the Caanoo already (I ported them a while back), but they've been updated and several bugs have been fixed.

The games are -

Guru Logic Champs - http://dl.openhandhelds.org/cgi-bin/caanoo.cgi?0,0,0,0,25,858

Balloonacy - http://dl.openhandhelds.org/cgi-bin/caanoo.cgi?0,0,0,0,25,859

Drench - http://dl.openhandhelds.org/cgi-bin/caanoo.cgi?0,0,0,0,25,860

Blitz - http://dl.openhandhelds.org/cgi-bin/caanoo.cgi?0,0,0,0,25,861

SantaMania - http://dl.openhandhelds.org/cgi-bin/caanoo.cgi?0,0,0,0,25,862

Enjoy.


15
This topic has been moved to Off Topic.

http://www.glbasic.com/forum/index.php?topic=8623.0

Announcements is for GLB games/apps and anything directly related to GLB.

Pages: [1] 2 3 ... 10