Posted: 29th Nov 2022 1:44
Simple Star wars credits screen crawl using SetObjectUVOffset() and SetObjectUVScale().
I tried to do a 2D version but I couldn't get the SpriteUV's to work

Posted: 29th Nov 2022 2:15
nice one.

i played with it a little to get closer to the original angle and have it almost fill the width of the screen at the bottom and end in the top 1/4 of the screen. got close but nothing worth sharing.

i wonder if heavens used a similar method in their recent 20 sec jam submission (cropped):


~45 years later and still inspiring, eh? it never gets old (but somehow i did).

+ Code Snippet
it's a trap!
Posted: 29th Nov 2022 18:17
Cool. Now make the top fade out!
Posted: 30th Nov 2022 1:39
Challenge accepted
Nice work VN!
Posted: 30th Nov 2022 10:35
Nice!
Posted: 30th Nov 2022 16:22
Fairly similar approach however mine was based on a timer and the object moved.

+ Code Snippet
// File: Code/Intro.agc
// Created: 22-11-20

// show all errors

SetErrorMode(2)

// set window properties
SetWindowTitle( "Intro" )
SetWindowSize( 1024, 768, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window

// set display properties
SetVirtualResolution( 1024, 768 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 )

Type _Intro
	Sprite
	Object As Integer
	TextMoveTimer# As Float
	EndTimer# As Float
EndType

Global Intro As _Intro
Global IntroImage As Integer

LoadData_Intro()
Generate_Intro()

do
	If Timer() - Intro.TextMoveTimer# > 0.01
		Intro.TextMoveTimer# = Timer()
		SetObjectPosition(Intro.Object, 0, 0, GetObjectZ(Intro.Object)+0.25)
	EndIf
	If Timer() - Intro.EndTimer# > 60 Or GetPointerPressed() = 1
		End
	EndIf
    Sync()
loop

Function LoadData_Intro()
	//IntroImage = LoadImage("Gfx/Intro/Text.png")
	IntroImage = LoadImage("crawl.png")
EndFunction

Function Generate_Intro()
	SetClearColor(0, 0, 0)
	Intro.Object = CreateObjectPlane(450, 400)
	RotateObjectLocalX(Intro.Object, 90)
	SetObjectImage(Intro.Object, IntroImage, 0)
	SetObjectPosition(Intro.Object, 0, 0, -480)
	SetCameraPosition(1, 0, 250, -500)

	Intro.TextMoveTimer# = Timer()
	Intro.EndTimer# = Timer()
EndFunction
Posted: 2nd Dec 2022 16:23
You won't be able to use Sprites without using a Shader., due to Affine Texturing issues.

+ Code Snippet
// Common Constants
#Constant True -1
#Constant False 0
#Constant Null 0
#Constant Enable 1
#Constant Disable 0

#Constant KEY_ESCAPE 27

Global AppRunning As Integer : AppRunning = True

// show all errors
SetErrorMode(2)

// set window properties
SetWindowTitle( "starwars" )
SetWindowSize( 1024, 768, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window

// set display properties
SetVirtualResolution( 1024, 768 ) // doesn't have to match the window
SetOrientationAllowed( Disable, Disable, Disable, Disable ) // allow both portrait and landscape on mobile devices
SetSyncRate( 0, Enable ) // 30fps instead of 60 to save battery
SetScissor( Null, Null, Null, Null ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( Enable )

Type Vector2
	X As Float
	Y As Float
EndType

Type Direction
	Left As Vector2
	Right As Vector2
EndType

Type Rect
	Top As Direction
	Bottom As Direction
EndType

UV As Rect

Global imgCrawl As Integer : imgCrawl = LoadImage( "Crawl.png" )
Global sprCrawl As Integer : sprCrawl = CreateSprite( CreateImageColor( 0, 0, 0, 255 ) )

SetSpriteSize( sprCrawl, GetVirtualWidth(), GetVirtualHeight() ) 
SetSpriteImage( sprCrawl, imgCrawl )

UV.Top.Left = CreateVector2( -0.5, 0.0 )
UV.Bottom.Left = CreateVector2( 0.0, 0.3 )
UV.Top.Right = CreateVector2( 1.5, 0.0 )
UV.Bottom.Right = CreateVector2( 1.0, 0.3 )

SetSpriteUV( sprCrawl, UV.Top.Left.X, UV.Top.Left.Y, UV.Bottom.Left.X, UV.Bottom.Left.Y, UV.Top.Right.X, UV.Top.Right.Y, UV.Bottom.Right.X, UV.Bottom.Right.Y )

// Main Loop
Repeat
	If GetRawKeyPressed( KEY_ESCAPE ) 
		AppRunning = Not( AppRunning )
	EndIf	
	
    Sync()
Until Not( AppRunning )

// Clean Up
DeleteSprite( sprCrawl )
DeleteImage( imgCrawl )

End

// Functions
Function CreateVector2( X As Float, Y As Float )
	Local Output As Vector2
	
	Output.X = X
	Output.Y = Y
EndFunction Output


Posted: 5th Dec 2022 0:00
Now make the top fade out!


spoiler alert "blink"
using a shader
+ Code Snippet
//using blinks code and a gradient transparent png i call overlay
image = LoadImage("crawl.png")
SetObjectUVScale(plane, 0, 1, .5)
overlay=loadImage("overlay.png")
blendshader=loadshader("blend.vs","blend.ps")


vs shader
+ Code Snippet
attribute vec3 position;
attribute vec2 uv;
  
varying vec2 uv0Varying;
varying vec2 uv1Varying;
uniform vec4 uvBounds0;
  
uniform mat4 agk_World;
uniform mat4 agk_ViewProj;
 
void main()
{
    vec4 pos = agk_World * vec4(position,1);
    gl_Position = agk_ViewProj * pos;
    uv0Varying = uv * uvBounds0.xy + uvBounds0.zw;
}


ps shader
+ Code Snippet
// constant values sent through from AGK code.
uniform sampler2D texture0; 
uniform sampler2D texture1; 

// Anything that the vertex shader passes as output needs to 
// be defined here as input. The vertex shader is passing the 
// texture coordinate, so it is defined again here.
varying vec2 uv0Varying;
varying vec2 uv1Varying;

void main()
{
  // copy the textures coords
  vec2 texCoord0 = uv0Varying;
  vec2 texCoord1 = uv1Varying;
  
  vec4 colorResult0  = texture2D(texture0, texCoord0);
  vec4 colorResult1  = texture2D(texture1, texCoord0); // you can change here the second uvlayer by texture2D(texture1, texCoord1) if you use different uvchanel for each texture
  
  gl_FragColor = mix(colorResult0, colorResult1, colorResult1.a); // mix with the alpha of the second texture. You can mix with a third texture if you want to use seamless texture and repeat it.
}
Posted: 5th Dec 2022 0:51
Nice Fubs!