It is currently Fri Dec 15, 2017 1:03 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: projectile patterns
PostPosted: Thu Aug 04, 2016 3:38 pm 
Offline

Joined: Wed May 19, 2010 6:12 pm
Posts: 2428
I can't believe I haven't thought about this before, but projectile patterns can be programmed using data tables. The data tables can have information like, how many projectiles to throw at once, the x/y offset from the enemy, the speed and angle, the amount of time between projectile throws, and the looping information. This is probably old news to some people, but I've been so caught up with graphical trickery, that I haven't thought much about this.


Top
 Profile  
 
 Post subject: Re: projectile patterns
PostPosted: Thu Aug 04, 2016 4:37 pm 
Offline
User avatar

Joined: Sat Jul 12, 2014 3:04 pm
Posts: 950
psycopathicteen wrote:
I can't believe I haven't thought about this before, but projectile patterns can be programmed using data tables. The data tables can have information like, how many projectiles to throw at once, the x/y offset from the enemy, the speed and angle, the amount of time between projectile throws, and the looping information. This is probably old news to some people, but I've been so caught up with graphical trickery, that I haven't thought much about this.

  • Angles should have option of being "absolute" or "relative to 'toward-player'".
  • Offsets should likewise be able to be able to be relative, as in "X pixels in direction-fired" with possible "Y pixels perpendicular to direction fired"
  • Projectile graphic/type
    • And hitbox, if separate.


Top
 Profile  
 
 Post subject: Re: projectile patterns
PostPosted: Tue Aug 09, 2016 10:42 pm 
Offline

Joined: Wed May 19, 2010 6:12 pm
Posts: 2428
Here is a code I just whipped up right now. It's for the 65816 though.

Code:
projectile_patterns:
ldy {projectile_data}
lda $0000,y
bpl +
sta {projectile_data}
tay
lda $0000,y
+;
inc {projectile_timer}
cmp {projectile_timer}
beq +
rts
+;
lda $0002,y
sta {temp}

iny #4

-;

jsr look_for_open_slot
cpx #{last_object_slot}
beq dont_spawn_projectile
lda $0000,y
sta.w {object_id},x

lda {direction}
sta.w {direction},x
bne +

lda {x_position}
clc
adc $00002,y
sta.w {x_position},x
bra ++
+;
lda {x_position}
sec
sbc $0002,y
sta.w {x_position},x
+;

lda {y_position}
clc
adc $0004,y
sta.w {y_position},x

lda $0006,y
sta.w {x_speed},x
lda $0008,y
sta.w {y_velocity},x

dont_spawn_projectile:

tya
clc
adc #$000a
tay

dec {temp}
bne -

sty {projectile_data}
stz {projectile_timer}
rts


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group