how to create a spark

  • PizzaPlatypus
    17th Jan 2011 Member 0 Permalink
    how would you make an element create a spark in c code?
  • Dragonfree97
    17th Jan 2011 Member 0 Permalink
    BTRY code?
  • PizzaPlatypus
    17th Jan 2011 Member 0 Permalink
    tried, but I'm trying to do it when something hits the thing that gives out spark.
  • PizzaPlatypus
    17th Jan 2011 Member 0 Permalink
    I mean if a specific item hits it I want it to give out spark
  • Uberness
    17th Jan 2011 Member 0 Permalink
    @PizzaPlatypus
    This sounds good, a detector thats not a wall.
  • plead-for-destruction
    17th Jan 2011 Member 0 Permalink
    specific I'm not sure about but if you combine detector wall with battery then that's what u want
  • Xenocide
    17th Jan 2011 Former Staff 0 Permalink
    my prefered code is:

    for(nx=-2; nx<3; nx++)
    for(ny=-2; ny<3; ny++)
    if(x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
    {
    r = pmap[y+ny][x+nx];
    if((r>>8)>=NPART || !r)
    continue;
    if(ptypes[(r&0xFF)].properties&PROP_CONDUCTS)
    create_part(r>>8, x+nx, y+ny, PT_SPRK);
    }

    Although this won't conduct to all elements.
  • PizzaPlatypus
    17th Jan 2011 Member 0 Permalink
    plead-for-destruction:
    specific I'm not sure about

    But I'm trying to make a solar panel element so it needs to be specific.