This doesnt work because ???? (drawing lines in a canvas)

Game Editor comments and discussion.

This doesnt work because ???? (drawing lines in a canvas)

Postby foleyjo » Tue Jul 31, 2007 8:23 pm

Draw actor event on a canvas

Code: Select all
int i;
i = 0;

for (i=0; i<=100; i++)
{
    setpen(255, 0,255, 0 ,i);
    lineto(1000, i);
}
foleyjo
 
Posts: 275
Joined: Mon Jul 09, 2007 1:15 pm
Score: 15 Give a positive score

Postby makslane » Tue Jul 31, 2007 11:06 pm

You must use at least one move to before use a line to:

Code: Select all
moveto(0, 0);
lineto(0, 10);
lineto(10, 10);
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby foleyjo » Wed Aug 01, 2007 8:09 am

Makes ence

Thank You!!
foleyjo
 
Posts: 275
Joined: Mon Jul 09, 2007 1:15 pm
Score: 15 Give a positive score

Postby foleyjo » Thu Aug 02, 2007 9:06 am

Well it seems I just wasted time here.

I wanted this code to make an energy bar. it worked my energy bar works.
It changes colour when it gets lower down it oes up when you pick up health.

The Problem. When I put it on the GP2X it now crashes the game
The Question - Can you not use the canvas on GP2X games?
foleyjo
 
Posts: 275
Joined: Mon Jul 09, 2007 1:15 pm
Score: 15 Give a positive score

Postby pixelpoop » Thu Aug 02, 2007 10:07 am

it is the erase part of your code that causes the crash.
User avatar
pixelpoop
 
Posts: 276
Joined: Tue Aug 29, 2006 9:32 pm
Score: 28 Give a positive score

Postby foleyjo » Thu Aug 02, 2007 10:35 am

OK then Ive taken that into acount and changed my code to avoid it.
Is there a better way to do this

in canvas draw actor
Code: Select all

//set pointer variable
int i;
i = 0;

//Make the whole energy bar black
setpen(0,0,0,0,i);

for (i=0; i<=10; i++)
{
    moveto(0,i);
    lineto(100, i);
}


//Change energy colour Green = safe Yellow = warning Red = Danger
//Energy is from 0 to 100 at 0 player character is destroyed
setpen(0, 255,0, 0 ,i);

if (player.plr_energy <=50)
   setpen(255,252, 0,0 , i);
if (player.plr_energy <=25)
     setpen(255,0,0,0,i);

//Draw  energy with colour
for (i=0; i<=10; i++)
{
    moveto(0,i);
    lineto(player.plr_energy, i);
}
foleyjo
 
Posts: 275
Joined: Mon Jul 09, 2007 1:15 pm
Score: 15 Give a positive score

Postby pixelpoop » Thu Aug 02, 2007 11:33 am

You could use a sprite, that seems much simpler.
User avatar
pixelpoop
 
Posts: 276
Joined: Tue Aug 29, 2006 9:32 pm
Score: 28 Give a positive score

Postby foleyjo » Thu Aug 02, 2007 11:42 am

I wanted an exact representation of the energy. I would need 100 frames to do it with sprites
foleyjo
 
Posts: 275
Joined: Mon Jul 09, 2007 1:15 pm
Score: 15 Give a positive score

Postby pixelpoop » Thu Aug 02, 2007 1:12 pm

It is easy if you use an animation program. Here is one I did in Flash in less than 5 minutes.
Attachments
healthstrip.gif
healthstrip.zip
animation of a simple health bar
(27.84 KiB) Downloaded 100 times
User avatar
pixelpoop
 
Posts: 276
Joined: Tue Aug 29, 2006 9:32 pm
Score: 28 Give a positive score

Postby foleyjo » Thu Aug 02, 2007 1:55 pm

See theres another problem i dont know how to make animations. I dont even know what package is best to use :oops:
foleyjo
 
Posts: 275
Joined: Mon Jul 09, 2007 1:15 pm
Score: 15 Give a positive score

Postby pixelpoop » Thu Aug 02, 2007 2:42 pm

You can use this animation for your project if you want.
Free software for animations and drawing/photo editing have been brought up many times in these forums. Do a search here or in google to find some. Look for software that has good documentation and walkthroughs.

Flash is a great tool but kind of pricey for just doing health bars.
User avatar
pixelpoop
 
Posts: 276
Joined: Tue Aug 29, 2006 9:32 pm
Score: 28 Give a positive score

Postby foleyjo » Thu Aug 02, 2007 3:18 pm

Ok. Thank you very much. I think I have all I need to be getting on with my game now.
Lets see how long I can go without getting stuck again :lol:
foleyjo
 
Posts: 275
Joined: Mon Jul 09, 2007 1:15 pm
Score: 15 Give a positive score

Postby pixelpoop » Thu Aug 02, 2007 9:11 pm

hey foleyjo

Makslane may have a fix for your erase problem soon. Keep your fingers crossed.
User avatar
pixelpoop
 
Posts: 276
Joined: Tue Aug 29, 2006 9:32 pm
Score: 28 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron