Shooter Module - Boundaries for the screen? How to...

Pete2kX

New member
Hello, in my shooter game I set the screens to scroll right and edge stops player so that I can`t get into the screen before and after the actual sceen (which would be strange when the game autoscrolls) :D

What about below and above? I can fly out of the screens and the only possibility I see for up and down is to set solid blocks on the first and last row...

Isn`t there a much easier way to set boundaries like edge stops player does for left and right?

Greetings
 

dale_coop

Moderator
Staff member
You could make custom DoBottomBoundsUpdate and DoTopBoundsUpdate scripts that would use the "Edges stops player" screen flag...
Something like that...

DoBottomBoundsUpdate_withStopEdges.asm:
Code:
	LDA screenFlags
	AND #%00000010
	BEQ +
	
	LDX player1_object
	LDA #BOUNDS_BOTTOM
	SEC
	SBC #$02
	SEC
	SBC Object_bottom,x
	STA yHold_hi
	STA Object_y_hi,x
	STA newY

	LDA Object_x_hi,x
	STA xHold_hi
	STA newX
	
	LDA #$00
	STA yHold_lo
	STA xHold_lo
	
	JMP doneBottomBounds
+	

	LDX player1_object

	LDA #BOUNDS_TOP
	CLC
	ADC #$01
	STA yHold_hi
	STA Object_y_hi,x
	STA newY

	LDA Object_x_hi,x
	STA xHold_hi
	STA newX
	
	LDA #$00
	STA yHold_lo
	STA xHold_lo
	


				;7 = active
				;6 = 8 or 16 px tiles
			
			;; warp map should stay the same.
			LDA Object_scroll,x
			CLC
			ADC #$10
			STA Object_scroll,x
			STA xScroll_hi
			STA newScreen
			STA currentNametable
			STA currentScreen ;currentScreen
			STA newScreen
			STA nt_hold
		;	clc
		;	adc #$01
		;	STA rightNametable
		;	SEC
		;	SBC #$02
			;STA leftNametable
		
			LDA #$01
			STA screen_transition_type
		
			;LDA warpMap
			;CLC
			;ADC #$01
			;STA update_screen_details
			
			;;; update screen details will not change with left, right, up or down movement
			;;; unless the edge of a map should take you to the other map or something.
			;;; warpMap variable is used solely to hold whether the warp-out is to overworld or underworld.
			LDA Object_scroll,x
			AND #%00000001
			STA showingNametable
			
			
	
	LDA #$00
	STA tile_solidity		
	LDA #$00
	STA gameHandler
	LDA #%11000000
	ORA #GS_MainGame
	ORA #%01000000
	STA update_screen
	
	LDA #$00
	STA xScroll
doneBottomBounds:

And the other one...
DoTopBoundsUpdate_withStopEdges.asm:
Code:
	LDA screenFlags
	AND #%00000010
	BEQ +
	
	LDX player1_object
	LDA #BOUNDS_TOP
	CLC
	ADC #$01
	STA yHold_hi
	STA Object_y_hi,x
	STA newY

	LDA Object_x_hi,x
	STA xHold_hi
	STA newX
	
	LDA #$00
	STA yHold_lo
	STA xHold_lo
	
	JMP doneTopBounds
+	


	LDX player1_object

	LDA #BOUNDS_BOTTOM
	SEC
	SBC #$02
	SEC
	SBC Object_bottom,x
	STA yHold_hi
	STA Object_y_hi,x
	STA newY

	LDA Object_x_hi,x
	STA xHold_hi
	STA newX
	
	LDA #$00
	STA yHold_lo
	STA xHold_lo
	


				;7 = active
				;6 = 8 or 16 px tiles
			
			;; warp map should stay the same.
			LDA Object_scroll,x
			sec
			sbc #$10
			STA Object_scroll,x
			STA xScroll_hi
			STA newScreen
			STA currentNametable
			STA currentScreen ;currentScreen
			STA newScreen
			STA nt_hold
		;	clc
		;	adc #$01
		;	STA rightNametable
		;	SEC
		;	SBC #$02
			;STA leftNametable
		
			LDA #$01
			STA screen_transition_type
		
			;LDA warpMap
			;CLC
			;ADC #$01
			;STA update_screen_details
			
			;;; update screen details will not change with left, right, up or down movement
			;;; unless the edge of a map should take you to the other map or something.
			;;; warpMap variable is used solely to hold whether the warp-out is to overworld or underworld.
			LDA Object_scroll,x
			AND #%00000001
			STA showingNametable
			
			
	
	LDA #$00
	STA tile_solidity		
	LDA #$00
	STA gameHandler
	LDA #%11000000
	ORA #GS_MainGame
	ORA #%01000000
	STA update_screen
	
	LDA #$00
	STA xScroll
doneTopBounds:

Save those scripts in your "Basic\ModuleScripts\MainScripts\BoundsHandlers" folder, and assign them to the "Handle Bottom Bounds" and "Handle Top Bounds" elements in the "Project Settings > Script Settings".
 

Pete2kX

New member
Hello dale_coop, once again thank you very much. I`ll try this :)

Greetings, Peter

PS: as for the other problem (spaceship animation while firing the laser) I tried but I found no solution yet.
 

Pete2kX

New member
Hello dale. I used the standard melee/laser from the shooter module. I wrote an update in the "Shooter Module - question about laser and Player animation" topic.

Greetings, Pete
 

Pete2kX

New member
Hello dale_coop. The laser animation issue works now, thank you very much.

I`ve created the 2 new asm files and assigned them in the project settings. Down doesn`t work, it still goes out of the screen, for up there are some glitches. The spaceship moves to the right on the upper screen and after that it goes into a new screen with dummy tiles. Do you have any ideas?

Greetings, Pete
 

Pete2kX

New member
Hello dale. Yes, the flag is activated on every screen.

But I'm sure that I set everything right. I saved the scripts and assigned them in the project settings, set edge stops player,... Perhaps it's just a small thing I forgot.

Greetings
Peter
 

dale_coop

Moderator
Staff member
Interesting...
Check again your assigned the correct scripts to the right element (in Project Settings > Script Settings)
You could share a screenshot, of that window if you are not sure.
 

Pete2kX

New member
Hello dale, I attached the files. I hope this helps.

Oh I had to reinstall my OS and everything, so there`s the editor and not notepad++ or something. But I hope this doesn`t take effect on this (it didn`t by now).

Greetigs
Pete
 

Attachments

  • bottom.PNG
    bottom.PNG
    107.3 KB · Views: 1,058
  • top.PNG
    top.PNG
    104.8 KB · Views: 1,058
  • screen info.PNG
    screen info.PNG
    31.3 KB · Views: 1,058
  • bottom projectscripts overview.PNG
    bottom projectscripts overview.PNG
    64.1 KB · Views: 1,058
  • top projectscripts overview.PNG
    top projectscripts overview.PNG
    62.9 KB · Views: 1,058

dale_coop

Moderator
Staff member
Thank you, looks good.
I maybe have made some mistakes in the code, maybe because of the auto scroll.
Let me check those scripts again tomorrow and find you better working scripts ;)
 

Pete2kX

New member
That`s really great!!! Thank you very much. I`m sorry that I can`t figure out myself what could be wrong in the code(s).

It`s all absolutely new to me with asm and the whole scripting thing itself :) I really hope that I get into it the next weeks/months :D

Greetings
 

dale_coop

Moderator
Staff member
It's definitely the AutoScroll that causing issues here with the scripts...
I can't find any way of fixing that easily. Sorry :(
 

Pete2kX

New member
Hello dale_coop, thanks for your reply :)

Okay, I think I switch to solid blocks then on the upper and lower screen. That's a good solution too.

Greetings
Pete
 

Pete2kX

New member
Oh no, there`s another problem now. I set black tiles with state "solid" as boundaries on the top and at the bottom.

But these tiles when touched drag the ship to the left with death as result.

Has anyone an idea how to prevent the ship from beeing dragged by solid tiles?

Greetings
Pete
 

Attachments

  • bounds.png
    bounds.png
    14.6 KB · Views: 1,140

Mugi

Member
i believe ratronaut has a solution for the "sliding walls" in his space raft game. Not sure if he actually shared that code but you could ask him.
 

dale_coop

Moderator
Staff member
Yes, on screens with "AutoScroll" solid tiles are kinda sticky. So you would need sliding type tiles...
Here's the "RailsTiles.asm" script I made for Raftronaut:

Code:
	;; checking center left collision point
	LDA collisionPoint4
	BNE RailsLeftRight		;; there is a left collision
	
	;; checking center right collision point
	LDA collisionPoint5
	BNE RailsLeftRight		;; there is a right collision

	;; checking center right collision point
	LDA collisionPoint0
	CLC
	ADC collisionPoint1
	BNE doRailSlidingDown	;; there is a top collision

	;; checking center right collision point
	LDA collisionPoint2
	CLC
	ADC collisionPoint3
	BNE doRailSlidingUp		;; there is a bottom collision
	

	  
	 
RailsTopBottom:	
	;; block vertical movement:
	LDA yPrev
	STA Object_y_hi,x
	STA yHold_hi
	;PlaySound #sfx_grind
	JMP endRails
	
RailsLeftRight:
	;; solid from sides:
	LDA #TILE_SOLID
	STA tile_solidity
	
	;; now checking the game pad (if pressing Up)
	;; to slide the player vertically
	LDA gamepad
	AND #%00010000
	BNE doRailSlidingDown


doRailSlidingDown:
	;; a small sliding down:
	LDA yPrev
	CLC
	ADC #$01
	STA Object_y_hi,x
	STA yHold_hi
	;PlaySound #sfx_grind
	JMP endRails
	
	
doRailSlidingUp:
	;; a small sliding up:
	LDA yPrev
	SEC
	SBC #$01
	STA Object_y_hi,x
	STA yHold_hi
	;PlaySound #sfx_grind
	
endRails:


Assign that new tile script to a unused "Tile Collision XXX" element in the Project Settings > Scripts Settings dialog.

2020-01-29-09-48-25-Param-tres-du-projet.png


And use that tile type for your bocks instead of the the "1-solid" one.
 

Pete2kX

New member
Hello dale_coop, it works perfectly!! Thank you very much!! I could get a lot of things to work today like this, 8 directional movement and the pal/ntsc auto sounddetection (thx to Mugi). My INL Kit should arrive this week so I can test the game on my pal console :)

Greetings
Pete
 

Raftronaut

Member
Ah yes, the sticky solid tiles, Dales fix works great for that.

In fact, using solid blocks for edges at the top and bottom of the screen are actually a good thing, since on a CRT the bottom row of tiles will get cut off by overscan, so it's best not to put any gameplay elements down there anyway.

I actually have been meaning to do a sort of vanilla Shmup tutorial on here here someday since there are some inherent flaws to the shooter module in general. It was the last of the modules to be released and likely given the least consideration since it is also seemingly the least popular. With a few extra tile types and other considerations you can get a pretty decent albeit basic Horizontal shmup cooking in Nesmaker. Since the upcoming version is supposedly supporting vertical scrolling as well, I may wait to make my tutorial until that is released so I can tackle both horizontal and vertical shooters.

I still have a lot to work through before I am really proficient enough to thoroughly explain it though. I am still simply bashing things together at this point.

I would recommend continuing to post any problems here in the mean time
 
Top Bottom