
-----------------------------------
platky
Wed Feb 25, 2009 9:03 pm

Shooting bullets
-----------------------------------
Im having a terrible problem with getting my shooting to work. So far there is a little box that shoots at me using a rand.int.
When the attack procedure is activatated the bullet is supposed to come out. The bullet moves with coding bullet_x-=25 which does move the bullet but not at a continuos speed. It moves but only in increments when the rand.int statement is true.
Anybody have any ideas on this. i will post code if anyone wants to see it...

-----------------------------------
saltpro15
Wed Feb 25, 2009 9:06 pm

RE:Shooting bullets
-----------------------------------
why use rand.int anyway? and posting the code would be helpful :D

-----------------------------------
platky
Thu Feb 26, 2009 8:30 am

Re: Shooting bullets
-----------------------------------
Heres the code


View.Set("graphics:700;350,position:center;center,nobuttonbar,nocursor,title:Tank Man")

var x,y : int
var rotate:int
var velocity:int
const gravity:int:=1
var random:int

var dude : int
var arm :int
var arm2:array 0..35 of int

var title:int
var level1:int

var enter:string(1)

var health:int
var enemy_damage:int
var damage:int

%Background colour
colorback(green)


health:=100
velocity:=0
x:=100
rotate:=0
y:=0
var keys : array char of boolean

var enemy_x:int:=maxx-25
var enemy_y:int:=22


%character
dude := Pic.FileNew ("Dude.bmp")
arm := Pic.FileNew ("arm.bmp")

title:= Pic.FileNew ("title.jpg")
level1:=Pic.FileNew ("level1.bmp")

for rep:0..35
    arm2 (rep):= Pic.Rotate (arm,rep*10,Pic.Width (arm) div 2 -6,Pic.Height (arm) div 2+4)
end for
var temparm:= arm2 (0)
%Character Procedure
procedure tankman
    Pic.Draw(dude,x,y,picMerge)
    Pic.Draw(temparm,x+12,y+43,picMerge)
    Draw.Box(x,y,x+55,y+100,blue)
    Draw.Box(x,y,x+72,y+38,blue)
end tankman

proc enemy
    Draw.FillOval(enemy_x,enemy_y,3,3,white)
    Draw.FillBox (maxx-30,30,maxx-5,15,purple)
    
end enemy

proc enemy_attack

    enemy_x-=25


    if enemy_x =x then
        health:=health-3
        enemy_x:=maxx-25
    end if
end enemy_attack

proc enemy_miss

end enemy_miss

procedure Health
health:=health-enemy_damage
if health 